#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repo(i, n) for (int i = 1; i <= n; i++)
#define foreach(c, itr) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define endl '\n'
typedef vector<int> vii;
typedef vector<int> vll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 2e5 + 4;

int powmod(int a, int b, int mod)
{
    int res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

int gcd(int a, int b)
{
    while (b > 0)
    {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

int is_prime(int n)
{
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}
int modI(int a, int m)
{
    int m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

long long mod_inv(long long a, long long m = MOD)
{
    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;
}

long long choose(long long n, long long r)
{
    long long product = 1;

    for (long long i = 0; i < r; i++)
        product = product * (n - i) % MOD * mod_inv(i + 1) % MOD;

    return product;
}

int bit[N];

// void init(void){
//     int i;
//     rep(i,(1<<20)) v[i] = 0;
// }

void update(int idx, int val)
{
    while (idx <= N)
    {
        bit[idx] += val;
        idx += idx & -idx;
    }
}

// int pref(int idx)
// {
//     int ans = 0;
//     while (idx > 0)
//     {
//         ans += bit[idx];
//         idx -= idx & -idx;
//     }
//     return ans;
// }
// long long get(vector<long long> &f, int pos) {
//     long long res = 0;
//     for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
//         res += f[pos];
//     return res;
// }

// void upd(vector<long long> &f, int pos, int val) {
//     for (; pos < int(f.size()); pos |= pos + 1) {
//         f[pos] += val;
//     }
// }
// int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
// int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
// int dx[4]={-1, +1, 0, 0};
// int dy[4]={0, 0, +1, -1};
/*************************************************************************************************************/
// bool prime[500000000];
// void pre()
// {
//     for (int i = 2; i < 500000000; i++)
//     {
//         if (!prime[i])
//         {
//             for (int j = 2 / i; j < 500000000; j += i)
//                 prime[j] = true;
//         }
//     }
// }
int r, b, g;
int rr[201], bb[201], gg[201];
int cache1[201][201][201];
int cache2[201][201][201];
int cache3[201][201][201];
int dp1(int i, int j, int k)
{
    //cout << i << " " << j << " " << k << endl;
    if ((i > r && j > g) || (i > r && k > b) || (k > b && j > g))
        return 0;
    int &ans = cache1[i][j][k];
    if (ans != -1)
        return ans;
    if (i <= r && j <= g)
        ans = rr[i] * gg[j] + dp1(i + 1, j + 1, k);
    if (i <= r && k <= b)
        ans = max(ans, rr[i] * bb[k] + dp1(i + 1, j, k + 1));
    if (k <= b && j <= g)
        ans = max(ans, gg[j] * bb[k] + dp1(i, j + 1, k + 1));

    return ans;
}

int main()
{
    cin >> r >> g >> b;
    for (int i = 1; i <= r; i++)
        cin >> rr[i];
    for (int i = 1; i <= g; i++)
        cin >> gg[i];
    for (int i = 1; i <= b; i++)
        cin >> bb[i];
    sort(rr + 1, rr + r + 1, greater<int>());
    sort(gg + 1, gg + g + 1, greater<int>());
    sort(bb + 1, bb + b + 1, greater<int>());
    rep(i, 201)
    {
        rep(j, 201)
        {
            rep(k, 201) cache1[i][j][k] = -1;
        }
    }
    int ans1 = dp1(1, 1, 1);
    c(ans1) return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repo(i, n) for (int i = 1; i <= n; i++)
#define foreach(c, itr) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define endl '\n'
typedef vector<int> vii;
typedef vector<int> vll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 2e5 + 4;

int powmod(int a, int b, int mod)
{
    int res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

int gcd(int a, int b)
{
    while (b > 0)
    {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

int is_prime(int n)
{
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}
int modI(int a, int m)
{
    int m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

long long mod_inv(long long a, long long m = MOD)
{
    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;
}

long long choose(long long n, long long r)
{
    long long product = 1;

    for (long long i = 0; i < r; i++)
        product = product * (n - i) % MOD * mod_inv(i + 1) % MOD;

    return product;
}

int bit[N];

// void init(void){
//     int i;
//     rep(i,(1<<20)) v[i] = 0;
// }

void update(int idx, int val)
{
    while (idx <= N)
    {
        bit[idx] += val;
        idx += idx & -idx;
    }
}

// int pref(int idx)
// {
//     int ans = 0;
//     while (idx > 0)
//     {
//         ans += bit[idx];
//         idx -= idx & -idx;
//     }
//     return ans;
// }
// long long get(vector<long long> &f, int pos) {
//     long long res = 0;
//     for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
//         res += f[pos];
//     return res;
// }

// void upd(vector<long long> &f, int pos, int val) {
//     for (; pos < int(f.size()); pos |= pos + 1) {
//         f[pos] += val;
//     }
// }
// int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
// int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
// int dx[4]={-1, +1, 0, 0};
// int dy[4]={0, 0, +1, -1};
/*************************************************************************************************************/
// bool prime[500000000];
// void pre()
// {
//     for (int i = 2; i < 500000000; i++)
//     {
//         if (!prime[i])
//         {
//             for (int j = 2 / i; j < 500000000; j += i)
//                 prime[j] = true;
//         }
//     }
// }
int r, b, g;
int rr[201], bb[201], gg[201];
ll cache1[201][201][201];
ll dp1(int i, int j, int k)
{
    //cout << i << " " << j << " " << k << endl;
    if ((i > r && j > g) || (i > r && k > b) || (k > b && j > g))
        return 0;
    ll &ans = cache1[i][j][k];
    if (ans != -1)
        return ans;
    if (i <= r && j <= g)
        ans = rr[i] * gg[j] + dp1(i + 1, j + 1, k);
    if (i <= r && k <= b)
        ans = max(ans, rr[i] * bb[k] + dp1(i + 1, j, k + 1));
    if (k <= b && j <= g)
        ans = max(ans, gg[j] * bb[k] + dp1(i, j + 1, k + 1));

    return ans;
}

int main()
{
    cin >> r >> g >> b;
    for (int i = 1; i <= r; i++)
        cin >> rr[i];
    for (int i = 1; i <= g; i++)
        cin >> gg[i];
    for (int i = 1; i <= b; i++)
        cin >> bb[i];
    sort(rr + 1, rr + r + 1, greater<int>());
    sort(gg + 1, gg + g + 1, greater<int>());
    sort(bb + 1, bb + b + 1, greater<int>());
    rep(i, 201)
    {
        rep(j, 201)
        {
            rep(k, 201) cache1[i][j][k] = -1;
        }
    }
    ll ans1 = dp1(1, 1, 1);
    c(ans1) return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repo(i, n) for (int i = 1; i <= n; i++)
#define foreach(c, itr) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define endl '\n'
typedef vector<int> vii;
typedef vector<int> vll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 2e5 + 4;

int powmod(int a, int b, int mod)
{
    int res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

int gcd(int a, int b)
{
    while (b > 0)
    {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

int is_prime(int n)
{
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}
int modI(int a, int m)
{
    int m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

long long mod_inv(long long a, long long m = MOD)
{
    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;
}

long long choose(long long n, long long r)
{
    long long product = 1;

    for (long long i = 0; i < r; i++)
        product = product * (n - i) % MOD * mod_inv(i + 1) % MOD;

    return product;
}

int bit[N];

// void init(void){
//     int i;
//     rep(i,(1<<20)) v[i] = 0;
// }

void update(int idx, int val)
{
    while (idx <= N)
    {
        bit[idx] += val;
        idx += idx & -idx;
    }
}

// int pref(int idx)
// {
//     int ans = 0;
//     while (idx > 0)
//     {
//         ans += bit[idx];
//         idx -= idx & -idx;
//     }
//     return ans;
// }
// long long get(vector<long long> &f, int pos) {
//     long long res = 0;
//     for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
//         res += f[pos];
//     return res;
// }

// void upd(vector<long long> &f, int pos, int val) {
//     for (; pos < int(f.size()); pos |= pos + 1) {
//         f[pos] += val;
//     }
// }
// int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
// int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
// int dx[4]={-1, +1, 0, 0};
// int dy[4]={0, 0, +1, -1};
/*************************************************************************************************************/
// bool prime[500000000];
// void pre()
// {
//     for (int i = 2; i < 500000000; i++)
//     {
//         if (!prime[i])
//         {
//             for (int j = 2 / i; j < 500000000; j += i)
//                 prime[j] = true;
//         }
//     }
// }
int r, b, g;
int rr[301], bb[301], gg[301];
ll cache1[301][301][301];
ll dp1(int i, int j, int k)
{
    if ((i > r && j > g) || (i > r && k > b) || (k > b && j > g))
        return 0;
    ll &ans = cache1[i][j][k];
    if (ans != -1)
        return ans;
    if (i <= r && j <= g)
        ans = rr[i] * gg[j] + dp1(i + 1, j + 1, k);
    if (i <= r && k <= b)
        ans = max(ans, rr[i] * bb[k] + dp1(i + 1, j, k + 1));
    if (k <= b && j <= g)
        ans = max(ans, gg[j] * bb[k] + dp1(i, j + 1, k + 1));
    return ans;
}

int main()
{
    cin >> r >> g >> b;
    for (int i = 1; i <= r; i++)
        cin >> rr[i];
    for (int i = 1; i <= g; i++)
        cin >> gg[i];
    for (int i = 1; i <= b; i++)
        cin >> bb[i];
    sort(rr + 1, rr + r + 1, greater<int>());
    sort(gg + 1, gg + g + 1, greater<int>());
    sort(bb + 1, bb + b + 1, greater<int>());
    rep(i, 301)
    {
        rep(j, 301)
        {
            rep(k, 301) cache1[i][j][k] = -1;
        }
    }
    ll ans1 = dp1(1, 1, 1);
    c(ans1) return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define be begin()
#define en end()
#define le length()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < n; i++)
#define repo(i, n) for (int i = 1; i <= n; i++)
#define foreach(c, itr) for (__typeof((c).begin()) itr = (c).begin(); itr != (c).end(); itr++)
#define fastIO                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)
#define eps 1e-6
#define pi 3.141592653589793
#define c(a) cout << a << "\n";
#define ao(a)        \
    for (auto i : a) \
        cout << i << " ";
#define endl '\n'
typedef vector<int> vii;
typedef vector<int> vll;
typedef pair<int, int> pii;
typedef pair<int, int> pll;
const int MOD = 1e9 + 7;
const int INF = 1e9;
const int N = 2e5 + 4;

int powmod(int a, int b, int mod)
{
    int res = 1;
    a %= mod;
    for (; b; b >>= 1)
    {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

int gcd(int a, int b)
{
    while (b > 0)
    {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm(int a, int b)
{
    return (a / gcd(a, b)) * b;
}

int is_prime(int n)
{
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}
int modI(int a, int m)
{
    int m0 = m, y = 0, x = 1;
    if (m == 1)
        return 0;
    while (a > 1)
    {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
        x += m0;
    return x;
}

long long mod_inv(long long a, long long m = MOD)
{
    return a == 1 ? 1 : m - mod_inv(m % a, a) * m / a;
}

long long choose(long long n, long long r)
{
    long long product = 1;

    for (long long i = 0; i < r; i++)
        product = product * (n - i) % MOD * mod_inv(i + 1) % MOD;

    return product;
}

int bit[N];

// void init(void){
//     int i;
//     rep(i,(1<<20)) v[i] = 0;
// }

void update(int idx, int val)
{
    while (idx <= N)
    {
        bit[idx] += val;
        idx += idx & -idx;
    }
}

// int pref(int idx)
// {
//     int ans = 0;
//     while (idx > 0)
//     {
//         ans += bit[idx];
//         idx -= idx & -idx;
//     }
//     return ans;
// }
// long long get(vector<long long> &f, int pos) {
//     long long res = 0;
//     for (; pos >= 0; pos = (pos & (pos + 1)) - 1)
//         res += f[pos];
//     return res;
// }

// void upd(vector<long long> &f, int pos, int val) {
//     for (; pos < int(f.size()); pos |= pos + 1) {
//         f[pos] += val;
//     }
// }
// int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1};
// int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1};
// int dx[4]={-1, +1, 0, 0};
// int dy[4]={0, 0, +1, -1};
/*************************************************************************************************************/
// bool prime[500000000];
// void pre()
// {
//     for (int i = 2; i < 500000000; i++)
//     {
//         if (!prime[i])
//         {
//             for (int j = 2 / i; j < 500000000; j += i)
//                 prime[j] = true;
//         }
//     }
// }
int main()
{

    ll r, b, g;
    cin >> r >> b >> g;
    priority_queue<ll> p1, p2, p3, p11, p22, p33;
    rep(i, r)
    {
        ll x;
        cin >> x;
        p1.push(x);
        p11.push(x);
    }
    rep(i, b)
    {
        ll x;
        cin >> x;
        p2.push(x);
        p22.push(x);
    }
    rep(i, g)
    {
        ll x;
        cin >> x;
        p3.push(x);
        p33.push(x);
    }
    ll sum = 0;

    while (true)
    {
        int a[3] = {0};
        if (p1.size())
            a[0] = p1.size();
        if (p2.size())
            a[1] = p2.size();
        if (p3.size())
            a[2] = p3.size();
        // cout << a[0] << " " << a[1] << " " << a[2] << endl;
        sort(a, a + 3);
        if (a[0] == 0 && a[1] == 0)
            break;
        int b[3] = {0};
        if (p1.size())
            b[0] = p1.top();
        if (p2.size())
            b[1] = p2.top();
        if (p3.size())
            b[2] = p3.top();
        sort(b, b + 3);
        // ll ans = 0;
        if (p1.size() && b[2] == p1.top())
        {
            p1.pop();
            if (p2.size() && b[1] == p2.top())
                p2.pop();
            else
                p3.pop();
        }
        else if (p2.size() && b[2] == p2.top())
        {
            p2.pop();
            if (p1.size() && b[1] == p1.top())
                p1.pop();
            else
                p3.pop();
        }
        else if (p3.size() && b[2] == p3.top())
        {
            p3.pop();
            if (p2.size() && b[1] == p2.top())
                p2.pop();
            else
                p1.pop();
        }
        sum += b[1] * b[2];
        // c(sum)
    }
    ll sum1 = 0;
    while (true)
    {
        int a[3] = {0};
        if (p11.size())
            a[0] = p11.size();
        if (p22.size())
            a[1] = p22.size();
        if (p33.size())
            a[2] = p33.size();
        //  cout << a[0] << " " << a[1] << " " << a[2] << endl;
        sort(a, a + 3);
        if (a[0] == 0 && a[1] == 0)
            break;
        // int b[3] = {0};
        // if (p1.size())
        //     b[0] = p1.top();
        // if (p2.size())
        //     b[1] = p2.top();
        // if (p3.size())
        //     b[2] = p3.top();
        // sort(b, b + 3);
        // ll ans = 0;
        int x, y;
        if (p11.size() && a[2] == p11.size())
        {
            x = p11.top();
            p11.pop();
            if (p22.size() && a[1] == p22.size())
                y = p22.top(), p22.pop();
            else
                y = p33.top(), p33.pop();
        }
        else if (p22.size() && a[2] == p22.size())
        {
            x = p22.top();
            p22.pop();
            if (p11.size() && a[1] == p11.size())
                y = p11.top(), p11.pop();
            else
                y = p33.top(), p33.pop();
        }
        else if (p33.size() && a[2] == p33.size())
        {
            x = p33.top();
            p33.pop();
            if (p22.size() && a[1] == p22.size())
                y = p22.top(), p22.pop();
            else
                y = p11.top(), p11.pop();
        }
        sum1 += x * y;
        //c(sum)
    }
    c(max(sum, sum1))

        return 0;
}


#include<bits/stdc++.h>
using namespace std;

#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        205
#define mod         1000000007
#define pi          3.1415926535897932384626433

ll R[MAXN],G[MAXN],B[MAXN];
ll dp[MAXN][MAXN][MAXN];

ll fun(ll r,ll g,ll b,ll sum){
    if((r<=0 && g<=0)||(r<=0 && b<=0)||(g<=0 && b<=0)){
        return sum;
    }
    if(dp[r][g][b]!=0){
        return dp[r][g][b];
    }
    ll pa=fun(r-1,g-1,b,   sum+R[r-1]*G[g-1]);
    ll pb=fun(r-1,g  ,b-1, sum+R[r-1]*B[b-1]);
    ll pc=fun(r  ,g-1,b-1, sum+G[g-1]*B[b-1]);
    dp[r][g][b]=max({pa,pb,pc});
    return dp[r][g][b];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll r,g,b,i;
    cin>>r>>g>>b;
    for(i=0;i<r;i++){
        cin>>R[i];
    }
    for(i=0;i<g;i++){
        cin>>G[i];
    }
    for(i=0;i<b;i++){
        cin>>B[i];
    }
    sort(R,R+r);
    sort(G,G+g);
    sort(B,B+b);
    // for(i=0;i<r;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<g;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<b;i++){
    //     cout<<B[i]<<" ";
    // }
    // cout<<endl;
    cout<<fun(r,g,b,0);
}


#include<bits/stdc++.h>
using namespace std;

#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        205
#define mod         1000000007
#define pi          3.1415926535897932384626433

ll R[MAXN],G[MAXN],B[MAXN];
ll dp[MAXN][MAXN][MAXN];

ll fun(ll r,ll g,ll b,ll sum){
    if((r<=0 && g<=0)||(r<=0 && b<=0)||(g<=0 && b<=0) || (g<=0 && g<=0 && b<=0)){
        return sum;
    }
    if(dp[r][g][b]!=-1){
        return dp[r][g][b];
    }
    ll pa=0,pb=0,pc=0;
    if(r>0 && g>0){
        pa=fun(r-1,g-1,b,   sum+R[r-1]*G[g-1]);
    }
    if(r>0 && b>0){
        pb=fun(r-1,g  ,b-1, sum+R[r-1]*B[b-1]);
    }
    if(g>0 && b>0){
        pc=fun(r  ,g-1,b-1, sum+G[g-1]*B[b-1]);
    }
    dp[r][g][b]=max({pa,pb,pc});
    return dp[r][g][b];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    memset(dp,-1,sizeof(dp));
    ll r,g,b,i;
    cin>>r>>g>>b;
    for(i=0;i<r;i++){
        cin>>R[i];
    }
    for(i=0;i<g;i++){
        cin>>G[i];
    }
    for(i=0;i<b;i++){
        cin>>B[i];
    }
    sort(R,R+r);
    sort(G,G+g);
    sort(B,B+b);
    // for(i=0;i<r;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<g;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<b;i++){
    //     cout<<B[i]<<" ";
    // }
    // cout<<endl;
    cout<<fun(r,g,b,0);
}


#include<bits/stdc++.h>
using namespace std;

#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        1000005
#define mod         1000000007
#define pi          3.1415926535897932384626433

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll r,g,b,i,mx,count=0,sum;
    cin>>r>>g>>b;
    ll R[r],G[g],B[b];
    for(i=0;i<r;i++){
        cin>>R[i];
    }
    for(i=0;i<g;i++){
        cin>>G[i];
    }
    for(i=0;i<b;i++){
        cin>>B[i];
    }
    sort(R,R+r);
    sort(G,G+g);
    sort(B,B+b);
    while(r>=1 || b>=1 || g>=1){
        mx=0;
        ll pair=0;
        if(r>=1 && g>=1){
            sum=R[r-1]*G[g-1];
            if(mx<=sum){
                mx=sum;
                pair=1;
            }
        }
        if(r>=1 && b>=1){
            sum=R[r-1]*B[b-1];
            if(mx<=sum){
                mx=sum;
                pair=2;
            }
        }
        if(g>=1 && b>=1){
            sum=G[g-1]*B[b-1];
            if(mx<=sum){
                mx=sum;
                pair=3;
            }
        }
        // cout<<mx<<"";
        if(pair==1){
            r--;
            g--;
        }
        if(pair==2){
            r--;
            b--;
        }
        if(pair==3){
            g--;
            b--;
        }
        count+=mx;
        if(pair==0){
            break;
        }
    }
    cout<<count<<endl;
}


#include<bits/stdc++.h>
using namespace std;

#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        205
#define mod         1000000007
#define pi          3.1415926535897932384626433

ll R[MAXN],G[MAXN],B[MAXN];
ll dp[MAXN][MAXN][MAXN];

ll fun(ll r,ll g,ll b,ll sum){
    if((r<=0 && g<=0)||(r<=0 && b<=0)||(g<=0 && b<=0)){
        return sum;
    }
    if(dp[r][g][b]!=0){
        return dp[r][g][b];
    }
    ll pa=0,pb=0,pc=0;
    if(r>0 && g>0){
        pa=fun(r-1,g-1,b,   sum+R[r-1]*G[g-1]);
    }
    if(r>0 && b>0){
        pb=fun(r-1,g  ,b-1, sum+R[r-1]*B[b-1]);
    }
    if(g>0 && b>0){
        pc=fun(r  ,g-1,b-1, sum+G[g-1]*B[b-1]);
    }
    dp[r][g][b]=max({pa,pb,pc});
    return dp[r][g][b];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll r,g,b,i;
    cin>>r>>g>>b;
    for(i=0;i<r;i++){
        cin>>R[i];
    }
    for(i=0;i<g;i++){
        cin>>G[i];
    }
    for(i=0;i<b;i++){
        cin>>B[i];
    }
    sort(R,R+r);
    sort(G,G+g);
    sort(B,B+b);
    // for(i=0;i<r;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<g;i++){
    //     cout<<R[i]<<" ";
    // }
    // cout<<endl;
    // for(i=0;i<b;i++){
    //     cout<<B[i]<<" ";
    // }
    // cout<<endl;
    cout<<fun(r,g,b,0);
}


#include<bits/stdc++.h>
using namespace std;

#define ll          long long int
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define ff          first
#define se          second
#define endl        '\n'
#define fd(n)       fixed<<setprecision(n)
#define MAX         100000000000000000
#define MAXN        205
#define mod         1000000007
#define pi          3.1415926535897932384626433

ll R[MAXN],G[MAXN],B[MAXN];
ll dp[MAXN][MAXN][MAXN];

ll fun(ll r,ll g,ll b){
    if((r<=0 && g<=0)||(r<=0 && b<=0)||(g<=0 && b<=0)){
        return 0;
    }
    if(dp[r][g][b]!=0){
        return dp[r][g][b];
    }
    ll pa=0,pb=0,pc=0;
    if(r>0 && g>0){
        pa=fun(r-1,g-1,b) + R[r-1]*G[g-1];
    }
    if(r>0 && b>0){
        pb=fun(r-1,g  ,b-1) + R[r-1]*B[b-1];
    }
    if(g>0 && b>0){
        pc=fun(r  ,g-1,b-1) + G[g-1]*B[b-1];
    }
    dp[r][g][b]=max({pa,pb,pc});
    return dp[r][g][b];
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll r,g,b,i;
    cin>>r>>g>>b;
    for(i=0;i<r;i++){
        cin>>R[i];
    }
    for(i=0;i<g;i++){
        cin>>G[i];
    }
    for(i=0;i<b;i++){
        cin>>B[i];
    }
    sort(R,R+r);
    sort(G,G+g);
    sort(B,B+b);
    cout<<fun(r,g,b);
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    long long ret = 0;
    while (empty < 2) {
        empty = 0;
        if ((idxb < 0 && idxr > -1 && idxg > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]))) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]))) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]))) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    int ret = 0;
    while (empty < 2) {
        if ((idxb < 0 && idxr > -1 && idxg > -1) || ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]))) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) || ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]))) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) || ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]))) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    int ret = 0;
    while (empty < 2) {
        empty = 0;
        if ((idxb < 0 && idxr > -1 && idxg > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]) && G[idxg] != R[idxr])) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;

            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]) && B[idxb] != R[idxr])) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]) && B[idxb] != G[idxg])) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    int ret = 0;
    while (empty < 2) {
        if ((idxb < 0 && idxr > -1 && idxg > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]) && G[idxg] != R[idxr])) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]) && B[idxb] != R[idxr])) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]) && B[idxb] != G[idxg])) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    long long ret = 0;
    while (empty < 2) {
        empty = 0;
        if ((idxb < 0 && idxr > -1 && idxg > -1) ||
            ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]))) {
            if (!((B[idxb] == G[idxg] && idxb > idxg) || (B[idxb] == R[idxr] && idxb > idxr))) {
                ret += G[idxg] * R[idxr];
                idxr--;
                idxg--;
                if (idxr < 0)
                    empty++;
                if (idxg < 0)
                    empty++;
                if (idxb < 0)
                    empty++;
                continue;
            }
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) ||
            ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]))) {
            if (!((G[idxg] == R[idxr] && idxg > idxr) || (G[idxg] == B[idxb] && idxg > idxb))) {
                ret += B[idxb] * R[idxr];
                idxr--;
                idxb--;
                if (idxr < 0)
                    empty++;
                if (idxg < 0)
                    empty++;
                if (idxb < 0)
                    empty++;
                continue;
            }

        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) ||
            ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]))) {
            if (!((R[idxr] == G[idxg] && idxr > idxg) || (R[idxr] == B[idxb] && idxr > idxb))) {
                ret += B[idxb] * G[idxg];
                idxg--;
                idxb--;
                if (idxr < 0)
                    empty++;
                if (idxg < 0)
                    empty++;
                if (idxb < 0)
                    empty++;
                continue;
            }
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;
int g, b, r;
int main() {

    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    vector<vector<vector<int> > > dp(2000, vector<vector<int> > (2000, vector<int> (2000, -1)));
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    reverse(R.begin(), R.end());
    reverse(G.begin(), G.end());
    reverse(B.begin(), B.end());
    dp[0][0][0] = 0;
    for (int i = 0; i < r; ++i) {
        for (int j = 0; j < g; ++j) {
            for (int k = 0; k < b; ++k) {
                if (k == 0 && j == 0 && i == 0)
                    continue;
                if (i >= 1 && j >= 1 && dp[i - 1][j - 1][k] > -1) {
                    dp[i][j][k] = dp[i - 1][j - 1][k] + G[j] * R[i];
                }
                if (j >= 1 && k >= 1 && dp[i][j - 1][k - 1] > -1) {
                    dp[i][j][k] = dp[i][j - 1][k - 1] + G[j] * B[k];
                }
                if (i >= 1 && k >= 1 && dp[i - 1][j][k - 1] > -1) {
                    dp[i][j][k] = dp[i - 1][j][k - 1] + R[i] * B[k];
                }
            }
        }
    }
    int max1 = 0;
    for (int i = 0; i < r; ++i) {
        for (int j = 0; j < g; ++j) {
            for (int k = 0; k < b; ++k) {
                if (dp[i][j][k] > max1)
                    max1 = dp[i][j][k];
            }
        }
    }
    cout << max1 << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    vector<vector<vector<int> > > dp(r + 1, vector<vector<int> > (g + 1, vector<int> (b + 1, -1)));
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    reverse(R.begin(), R.end());
    reverse(G.begin(), G.end());
    reverse(B.begin(), B.end());
    dp[0][0][0] = 0;
    for (int i = 0; i <= r; ++i) {
        for (int j = 0; j <= g; ++j) {
            for (int k = 0; k <= b; ++k) {
                if (k == 0 && j == 0 && i == 0)
                    continue;
                int max1 = 0;
                if (i >= 1 && j >= 1 && dp[i - 1][j - 1][k] > -1) {
                    max1 = max(max1, dp[i - 1][j - 1][k] + G[j - 1] * R[i - 1]);
                }
                if (j >= 1 && k >= 1 && dp[i][j - 1][k - 1] > -1) {
                    max1 = max(dp[i][j - 1][k - 1] + G[j - 1] * B[k - 1], max1);
                }
                if (i >= 1 && k >= 1 && dp[i - 1][j][k - 1] > -1) {
                    max1 = max(max1, dp[i - 1][j][k - 1] + R[i - 1] * B[k - 1]);
                }
                dp[i][j][k] = max1;
            }
        }
    }
    int max1 = 0;
    for (int i = 0; i <= r; ++i) {
        for (int j = 0; j <= g; ++j) {
            for (int k = 0; k <= b; ++k) {
                if (dp[i][j][k] > max1)
                    max1 = dp[i][j][k];
            }
        }
    }
    cout << max1 << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    int ret = 0;
    while (empty < 2) {
        if ((idxb < 0 && idxr > -1 && idxg > -1) || B[idxb] <= min(G[idxg], R[idxr])) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) || G[idxg] <= min(B[idxb], R[idxr])) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) || R[idxr] <= min(B[idxb], G[idxg])) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>

using namespace std;

int main() {
    int g, b, r;
    cin >> r >> g >> b;
    vector<int> R(r);
    vector<int> G(g);
    vector<int> B(b);
    for (int i = 0; i < r; ++i) { cin >> R[i]; }
    for (int i = 0; i < g; ++i) { cin >> G[i]; }
    for (int i = 0; i < b; ++i) { cin >> B[i]; }
    sort(R.begin(), R.end());
    sort(G.begin(), G.end());
    sort(B.begin(), B.end());
    int empty = 0;
    if (R.empty())
        empty++;
    if (G.empty())
        empty++;
    if (B.empty())
        empty++;
    int idxr = r - 1;
    int idxg = g - 1;
    int idxb = b - 1;
    int ret = 0;
    while (empty < 2) {
        empty = 0;
        if ((idxb < 0 && idxr > -1 && idxg > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && B[idxb] <= min(G[idxg], R[idxr]))) {
            ret += G[idxg] * R[idxr];
            idxr--;
            idxg--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxg < 0 && idxr > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && G[idxg] <= min(B[idxb], R[idxr]))) {
            ret += B[idxb] * R[idxr];
            idxr--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
        if ((idxr < 0 && idxg > -1 && idxb > -1) ||
        ((idxg > -1 && idxr > -1 && idxb > -1) && R[idxr] <= min(B[idxb], G[idxg]))) {
            ret += B[idxb] * G[idxg];
            idxg--;
            idxb--;
            if (idxr < 0)
                empty++;
            if (idxg < 0)
                empty++;
            if (idxb < 0)
                empty++;
            continue;
        }
    }
    cout << ret << "\n";
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

ll rgb(vl r, vl g, vl b){
    int z1=r.size(),z2=g.size(),z3=b.size();
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0ll;}
    if(cnt==1){
        if(z1==0){
            ll y=g[z2-1],z=b[z3-1];
            g.pop_back(); b.pop_back();
            ll gb=y*z; return gb+rgb(r,g,b);
        }
        if(z2==0){
            ll x=r[z1-1],z=b[z3-1];
            r.pop_back(); b.pop_back();
            ll rb=x*z; return rb+rgb(r,g,b);
        }
        if(z3==0){
            ll x=r[z1-1],y=g[z2-1];
            r.pop_back(); g.pop_back();
            ll rg=x*y; return rg+rgb(r,g,b);
        }
    }
    ll x=r[z1-1],y=g[z2-1],z=b[z3-1];
    ll rg=x*y,gb=y*z,rb=x*z;
    if(rg>gb && rg>rb){
        r.pop_back(); g.pop_back();
        return rg+rgb(r,g,b);
    }
    if(gb>rg && gb>rb){
        g.pop_back(); b.pop_back();
        return gb+rgb(r,g,b);
    }
    if(rb>gb && rg<rb){
        r.pop_back(); b.pop_back();
        return rb+rgb(r,g,b);
    }
    if(rg>rb && rg==gb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); g.pop_back();
        ll ans1=rg+rgb(r,g,b);
        r.push_back(lr); b.pop_back();
        ll ans2=gb+rgb(r,g,b);
        return max(ans1,ans2);
    }
    if(rg>gb && rg==rb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); g.pop_back();
        ll ans1=rg+rgb(r,g,b);
        g.push_back(lg); b.pop_back();
        ll ans2=rb+rgb(r,g,b);
        return max(ans1,ans2);
    }
    if(rb>rg && rb==gb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); b.pop_back();
        ll ans1=rb+rgb(r,g,b);
        r.push_back(lr); g.pop_back();
        ll ans2=gb+rgb(r,g,b);
        return max(ans1,ans2);
    }
    if(rg==gb &&gb==rb){
                ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); g.pop_back();
        ll ans1=rg+rgb(r,g,b);
        r.push_back(lr); b.pop_back();
        ll ans2=gb+rgb(r,g,b);
        r.pop_back(); g.push_back(lg);
        ll ans3=rb+rgb(r,g,b);
        return max(ans1,max(ans2,ans3));
    }
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   for(int i=0; i<nr; i++){
        cin>>r[i];
   }
   for(int i=0; i<ng; i++){
        cin>>g[i];
   }
   for(int i=0; i<nb; i++){
        cin>>b[i];
   }
   sort(rng(r)); sort(rng(g)); sort(rng(b));
   ll ans=rgb(r,g,b);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   ll dp[207][207][207];
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   for(int i=0; i<=nr; i++){
        for(int j=0; j<=ng; j++){
            for(int k=0; k<=nb; k++){
                if(i&&j){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k]+r[i-1]*g[j-1]);
                }
                if(j&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+g[j-1]*b[k-1]);
                }
                if(i&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+r[i-1]*b[k-1]);
                }
            }
        }
   }
   cout<<dp[nr][ng][nb]<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

void solve(){
    int n; cin>>n;
    string s; cin>>s;
    vi a(n);
    for(int i=0; i<n; i++){
        a[i]=s[i]-'0';
        a[i]--;
    }
    map<int,int> cnt;
    int ans=0,cur=0;
    cnt[0]=1;
    for(int i=0; i<n; i++){
        cur+=a[i];
        ans+=cnt[cur];
        cnt[cur]++;
    }
    cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

ll rgb(vl r, vl g, vl b){
    int z1=r.size(),z2=g.size(),z3=b.size();
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0ll;}
    if(cnt==1){
        if(z1==0){
            ll y=g[z2-1],z=b[z3-1];
            g.pop_back(); b.pop_back();
            ll gb=y*z; return gb+rgb(r,g,b);
        }
        if(z2==0){
            ll x=r[z1-1],z=b[z3-1];
            r.pop_back(); b.pop_back();
            ll rb=x*z; return rb+rgb(r,g,b);
        }
        if(z3==0){
            ll x=r[z1-1],y=g[z2-1];
            r.pop_back(); g.pop_back();
            ll rg=x*y; return rg+rgb(r,g,b);
        }
    }
    ll x=r[z1-1],y=g[z2-1],z=b[z3-1];
    ll rg=x*y,gb=y*z,rb=x*z;
    if(rg>gb && rg>rb){
        r.pop_back(); g.pop_back();
        return rg+rgb(r,g,b);
    }
    if(gb>rg && gb>rb){
        g.pop_back(); b.pop_back();
        return gb+rgb(r,g,b);
    }
    if(rb>gb && rg<rb){
        r.pop_back(); b.pop_back();
        return rb+rgb(r,g,b);
    }
    if(rg>rb && rg==gb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); g.pop_back();
        ll ans1=rg+rgb(r,g,b);
        r.push_back(lr); b.pop_back();
        ll ans2=gb+rgb(r,g,b);
        return max(ans1,ans2);
    }
    if(rg>gb && rg==rb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); g.pop_back();
        ll ans1=rg+rgb(r,g,b);
        g.push_back(lg); b.pop_back();
        ll ans2=rb+rgb(r,g,b);
        return max(ans1,ans2);
    }
    if(rb>rg && rb==gb){
        ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
        r.pop_back(); b.pop_back();
        ll ans1=rb+rgb(r,g,b);
        r.push_back(lr); g.pop_back();
        ll ans2=gb+rgb(r,g,b);
        return max(ans1,ans2);
    }
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   for(int i=0; i<nr; i++){
        cin>>r[i];
   }
   for(int i=0; i<ng; i++){
        cin>>g[i];
   }
   for(int i=0; i<nb; i++){
        cin>>b[i];
   }
   sort(rng(r)); sort(rng(g)); sort(rng(b));
   ll ans=rgb(r,g,b);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   ll dp[201][201][201];
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   for(int i=0; i<=nr; i++){
        for(int j=0; j<=ng; j++){
            for(int k=0; k<=nb; k++){
                if(i&&j){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k]+r[i-1]*g[j-1]);
                }
                if(j&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+g[j-1]*b[k-1]);
                }
                if(i&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+r[i-1]*b[k-1]);
                }
            }
        }
   }
   cout<<dp[nr][ng][nb]<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}
#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   ll dp[201][201][201];
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   for(int i=0; i<=nr; i++){
        for(int j=0; j<=ng; j++){
            for(int k=0; k<=nb; k++){
                if(i&&j){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k]+r[i-1]*g[j-1]);
                }
                if(j&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+g[j-1]*b[k-1]);
                }
                if(i&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+r[i-1]*b[k-1]);
                }
            }
        }
   }
   cout<<dp[nr][ng][nb]<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

int rgb(vi r, vi g, vi b){
    int z1=r.size(),z2=g.size(),z3=b.size();
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0;}
    if(cnt==1){
        if(z1==0){
            int y=g[z2-1],z=b[z3-1];
            g.pop_back(); b.pop_back();
            int gb=y*z; return gb+rgb(r,g,b);
        }
        if(z2==0){
            int x=r[z1-1],z=b[z3-1];
            r.pop_back(); b.pop_back();
            int rb=x*z; return rb+rgb(r,g,b);
        }
        if(z3==0){
            int x=r[z1-1],y=g[z2-1];
            r.pop_back(); g.pop_back();
            int rg=x*y; return rg+rgb(r,g,b);
        }
    }
    int x=r[z1-1],y=g[z2-1],z=b[z3-1];
    int rg=x*y,gb=y*z,rb=x*z;
    int lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
    r.pop_back(); g.pop_back();
    int ans1=rg+rgb(r,g,b);
    r.push_back(lr); b.pop_back();
    int ans2=gb+rgb(r,g,b);
    r.pop_back(); g.push_back(lg);
    int ans3=rb+rgb(r,g,b);
    return max(ans1,max(ans2,ans3));
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vi r(nr),g(ng),b(nb);
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   int ans=rgb(r,g,b);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

vi r,g,b;

int rgb(int z1, int z2, int z3){
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0;}
    if(cnt==1){
        if(z1==0){
            int y=g[z2-1],z=b[z3-1];
            int gb=y*z; return gb+rgb(z1,z2-1,z3-1);
        }
        if(z2==0){
            int x=r[z1-1],z=b[z3-1];
            int rb=x*z; return rb+rgb(z1-1,z2,z3-1);
        }
        if(z3==0){
            int x=r[z1-1],y=g[z2-1];
            int rg=x*y; return rg+rgb(z1-1,z2-1,z3);
        }
    }
    int x=r[z1-1],y=g[z2-1],z=b[z3-1];
    int rg=x*y,gb=y*z,rb=x*z;
    int ans1=rg+rgb(z1-1,z2-1,z3);
    int ans2=gb+rgb(z1,z2-1,z3-1);
    int ans3=rb+rgb(z1-1,z2,z3-1);
    return max(ans1,max(ans2,ans3));
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   r.resize(nr); g.resize(ng); b.resize(nb);
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   int ans=rgb(nr,ng,nb);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

ll rgb(vl r, vl g, vl b){
    int z1=r.size(),z2=g.size(),z3=b.size();
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0ll;}
    if(cnt==1){
        if(z1==0){
            ll y=g[z2-1],z=b[z3-1];
            g.pop_back(); b.pop_back();
            ll gb=y*z; return gb+rgb(r,g,b);
        }
        if(z2==0){
            ll x=r[z1-1],z=b[z3-1];
            r.pop_back(); b.pop_back();
            ll rb=x*z; return rb+rgb(r,g,b);
        }
        if(z3==0){
            ll x=r[z1-1],y=g[z2-1];
            r.pop_back(); g.pop_back();
            ll rg=x*y; return rg+rgb(r,g,b);
        }
    }
    ll x=r[z1-1],y=g[z2-1],z=b[z3-1];
    ll rg=x*y,gb=y*z,rb=x*z;
    ll lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
    r.pop_back(); g.pop_back();
    ll ans1=rg+rgb(r,g,b);
    r.push_back(lr); b.pop_back();
    ll ans2=gb+rgb(r,g,b);
    r.pop_back(); g.push_back(lg);
    ll ans3=rb+rgb(r,g,b);
    return max(ans1,max(ans2,ans3));
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   ll ans=rgb(r,g,b);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

int rgb(vl r, vl g, vl b){
    int z1=r.size(),z2=g.size(),z3=b.size();
    int cnt=0;
    if(z1==0){cnt++;}
    if(z2==0){cnt++;}
    if(z3==0){cnt++;}
    if(cnt>=2){return 0;}
    if(cnt==1){
        if(z1==0){
            int y=g[z2-1],z=b[z3-1];
            g.pop_back(); b.pop_back();
            int gb=y*z; return gb+rgb(r,g,b);
        }
        if(z2==0){
            int x=r[z1-1],z=b[z3-1];
            r.pop_back(); b.pop_back();
            int rb=x*z; return rb+rgb(r,g,b);
        }
        if(z3==0){
            int x=r[z1-1],y=g[z2-1];
            r.pop_back(); g.pop_back();
            int rg=x*y; return rg+rgb(r,g,b);
        }
    }
    int x=r[z1-1],y=g[z2-1],z=b[z3-1];
    int rg=x*y,gb=y*z,rb=x*z;
    int lr=r[z1-1],lg=g[z2-1],lb=b[z3-1];
    r.pop_back(); g.pop_back();
    int ans1=rg+rgb(r,g,b);
    r.push_back(lr); b.pop_back();
    int ans2=gb+rgb(r,g,b);
    r.pop_back(); g.push_back(lg);
    int ans3=rb+rgb(r,g,b);
    return max(ans1,max(ans2,ans3));
}

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vi r(nr),g(ng),b(nb);
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   int ans=rgb(r,g,b);
   cout<<ans<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define rng(x) x.begin(), x.end()
#define pb push_back
#define f first
#define s second

typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;

/*-----------------------------Code begins----------------------------------*/

void solve(){
   int nr,ng,nb; cin>>nr>>ng>>nb;
   vl r(nr),g(ng),b(nb);
   ll dp[201][201][201];
   for(int i=0; i<nr; i++){cin>>r[i];}
   for(int i=0; i<ng; i++){cin>>g[i];}
   for(int i=0; i<nb; i++){cin>>b[i];}
   sort(rng(r)); sort(rng(b)); sort(rng(g));
   for(int i=0; i<=nr; i++){
        for(int j=0; j<=ng; j++){
            for(int k=0; k<=nb; k++){
                if(i&&j){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j-1][k]+r[i-1]*g[j-1]);
                }
                if(j&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+g[j-1]*b[k-1]);
                }
                if(i&&k){
                    dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k-1]+r[i-1]*b[k-1]);
                }
            }
        }
   }
   cout<<dp[nr][ng][nb]<<"\n";
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);  cout.tie(0);
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}


#undef _GLIBCXX_DEBUG

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

void trace(int x)                         { cerr << x; }
void trace(long x)                        { cerr << x; }
void trace(long long x)                   { cerr << x; }
void trace(unsigned x)                    { cerr << x; }
void trace(unsigned long x)               { cerr << x; }
void trace(unsigned long long x)          { cerr << x; }
void trace(float x)                       { cerr << x; }
void trace(double x)                      { cerr << x; }
void trace(long double x)                 { cerr << x; }
void trace(char x)                        { cerr << '\'' << x << '\''; }
void trace(const char *x)                 { cerr << '\"' << x << '\"'; }
void trace(const string &x)               { cerr << '\"' << x << '\"'; }
void trace(bool x)                        { cerr << (x ? "true" : "false"); }

template <typename A, typename B>                         void trace(const pair <A, B> &x)         { cerr << '{'; trace(x.first); cerr << ','; trace(x.second); cerr << '}'; }
template <typename A, typename B, typename C>             void trace(const tuple <A, B, C> &x)     { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << '}'; }
template <typename A, typename B, typename C, typename D> void trace(const tuple <A, B, C, D> &x)  { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << ','; trace(get <3> (x)); cerr << '}'; }
template <typename T>                                     void trace(const T &x)                   { int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), trace(i); cerr << "}"; }
template <size_t N>                                       void trace(bitset <N> v)                 { cerr << '{'; for (size_t i = 0; i < N; i++) cerr << static_cast <char> ('0' + v[i]); cerr << '}'; }
void _print()                                                                                { cerr << "]\n"; }
template <typename T, typename... V>                      void _print(T t, V... v)                 { trace(t); if (sizeof...(v)) cerr << ", "; _print(v...); }

#ifndef ONLINE_JUDGE
      #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
      #define debug(x...)
#endif // ONLINE_JUDGE

template <typename T> using ordered_set                = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T1, typename T2> using ordered_map  = tree <T1, T2, less <T1>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> T binaryExpo(T a, T p)              { if (p == 0) { return 1LL; } if (p == 1) { return a; } if (p & 1) { return a * binaryExpo(a, p - 1); } T ret = binaryExpo(a, p / 2); return ret * ret; }
template <class T> T bigMod(T a, T p, T m)             { if (p == 0) { return 1LL % m; } if (p == 1) { return a % m; } if (p & 1) { return (a % m * bigMod(a, p - 1, m)) % m; } T ret = bigMod(a, p / 2, m) % m; return (ret * ret) % m; }
template <class T> T modInv(T a, T m)                  { return bigMod(a, m - 2, m); }

template <class T> bool MIN(T &a, T b)                 { return a > b ? (a = b, true) : false; }
template <class T> bool MAX(T &a, T b)                 { return a < b ? (a = b, true) : false; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define ll              long long int
#define ull             unsigned long long int
#define ld              long double
#define endl            '\n'
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define mk              make_pair
#define ff              first
#define ss              second
#define all(a)          (a).begin(), (a).end()
#define rall(a)         (a).rbegin(), (a).rend()
#define eb              emplace_back
#define pb              push_back
#define pf              push_front
#define sz(a)           (int)(a.size())
#define ook             order_of_key             // The number of items in a set that are strictly smaller than k
#define fbo             find_by_order            // It returns an iterator to the i'th largest element
#define ATCODER         if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); }

#define int             long long int

const int maxn = 3e5 + 5;
const int logn = 19;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

int r;
int g;
int b;
vector <int> red;
vector <int> green;
vector <int> blue;
int dp[201][201][202];

int solve(int rpos, int gpos, int bpos) {
      if (rpos >= 200 or gpos >= 200 or bpos >= 200) {
            return 0;
      }
      if (rpos >= r and gpos >= g) {
            return 0;
      }
      if (rpos >= r and bpos >= b) {
            return 0;
      }
      if (gpos >= g and bpos >= b) {
            return 0;
      }
      int &ret = dp[rpos][gpos][bpos];
      if (~ret) {
            return ret;
      }
      ret = solve(rpos + 1, gpos, bpos);
      MAX(ret, solve(rpos, gpos + 1, bpos));
      MAX(ret, solve(rpos, gpos, bpos + 1));
      if (rpos < r) {
            if (gpos < g) {
                  int go = red[rpos] * green[gpos] + solve(rpos + 1, gpos + 1, bpos);
                  MAX(ret, go);
            }
            if (bpos < b) {
                  int go = red[rpos] * blue[bpos] + solve(rpos + 1, gpos, bpos + 1);
                  MAX(ret, go);
            }
      }
      if (gpos < g) {
            if (rpos < r) {
                  int go = red[rpos] * green[gpos] + solve(rpos + 1, gpos + 1, bpos);
                  MAX(ret, go);
            }
            if (bpos < b) {
                  int go = green[gpos] * blue[bpos] + solve(rpos, gpos + 1, bpos + 1);
                  MAX(ret, go);
            }
      }
      if (bpos < b) {
            if (rpos < r) {
                  int go = red[rpos] * blue[bpos] + solve(rpos + 1, gpos, bpos + 1);
                  MAX(ret, go);
            }
            if (gpos < g) {
                  int go = green[gpos] * blue[bpos] + solve(rpos, gpos + 1, bpos + 1);
                  MAX(ret, go);
            }
      }
//      debug(rpos, gpos, bpos, ret);
      return ret;
}

void Task() {
      /*
      int r, g, b;
      cin >> r >> g >> b;
      multiset <int> aliveRed;
      multiset <int> aliveGreen;
      multiset <int> aliveBlue;
      multiset <pii> alive;
      int RED = 1;
      int GREEN = 2;
      int BLUE = 3;
      for (int i = 1; i <= r; i++) {
            int x;
            cin >> x;
            aliveRed.insert(x);
            alive.insert(mk(x, 1));
      }
      for (int i = 1; i <= g; i++) {
            int x;
            cin >> x;
            aliveGreen.insert(x);
            alive.insert(mk(x, 2));
      }
      for (int i = 1; i <= b; i++) {
            int x;
            cin >> x;
            aliveBlue.insert(x);
            alive.insert(mk(x, 3));
      }
      int area = 0;
      while (alive.size()) {
            debug(alive);
            pii last = *alive.rbegin();
            alive.erase(alive.find(last));
            int x = last.first;
            int color = last.second;
            debug(x, color);
            if (color == RED) {
//                  debug("GB", aliveGreen, aliveBlue);
                  aliveRed.erase(aliveRed.find(x));
                  int maxGreen = 0;
                  if (sz(aliveGreen)) {
                        maxGreen = *aliveGreen.rbegin();
                  }
                  int maxBlue = 0;
                  if (sz(aliveBlue)) {
                        maxBlue = *aliveBlue.rbegin();
                  }
                  int maxi = max(maxGreen, maxBlue);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxGreen > maxBlue) {
                        area += x * maxGreen;
                        aliveGreen.erase(aliveGreen.find(maxGreen));
                        alive.erase(alive.find(mk(maxGreen, GREEN)));
                  }
                  else {
                        area += x * maxBlue;
                        aliveBlue.erase(aliveBlue.find(maxBlue));
                        alive.erase(alive.find(mk(maxBlue, BLUE)));
                  }
            }
            else if (color == GREEN) {
                  aliveGreen.erase(aliveGreen.find(x));
                  int maxRed = 0;
                  if (sz(aliveRed)) {
                        maxRed = *aliveRed.rbegin();
                  }
                  int maxBlue = 0;
                  if (sz(aliveBlue)) {
                        maxBlue = *aliveBlue.rbegin();
                  }
                  int maxi = max(maxRed, maxBlue);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxRed > maxBlue) {
                        area += x * maxRed;
                        aliveRed.erase(aliveRed.find(maxRed));
                        alive.erase(alive.find(mk(maxRed, RED)));
                  }
                  else {
                        area += x * maxBlue;
                        aliveBlue.erase(aliveBlue.find(maxBlue));
                        alive.erase(alive.find(mk(maxBlue, BLUE)));
                  }
            }
            else {
                  aliveBlue.erase(aliveBlue.find(x));
                  int maxRed = 0;
                  if (sz(aliveRed)) {
                        maxRed = *aliveRed.rbegin();
                  }
                  int maxGreen = 0;
                  if (sz(aliveGreen)) {
                        maxGreen = *aliveGreen.rbegin();
                  }
                  int maxi = max(maxRed, maxGreen);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxRed > maxGreen) {
                        area += x * maxRed;
                        aliveRed.erase(aliveRed.find(maxRed));
                        alive.erase(alive.find(mk(maxRed, RED)));
                  }
                  else {
                        area += x * maxGreen;
                        aliveGreen.erase(aliveGreen.find(maxGreen));
                        alive.erase(alive.find(mk(maxGreen, GREEN)));
                  }
            }
      }
      cout << area << endl;
      */

      cin >> r >> g >> b;
      for (int i = 1; i <= r; i++) {
            int x;
            cin >> x;
            red.push_back(x);
      }
      for (int i = 1; i <= g; i++) {
            int x;
            cin >> x;
            green.push_back(x);
      }
      for (int i = 1; i <= b; i++) {
            int x;
            cin >> x;
            blue.push_back(x);
      }
      memset(dp, -1, sizeof dp);
      cout << solve(0, 0, 0) << endl;
}

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr); cout.tie(nullptr);
      cout.precision(12);

      bool FILEIO = 0;
      if (FILEIO and fopen("in.txt", "r")) {
            freopen("in.txt", "r", stdin);
      }

      int tc = 1;
      while (tc--) {
            Task();
      }

      #ifndef ONLINE_JUDGE
            cerr << endl << "Time : " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
      #endif // ONLINE_JUDGE
}


#undef _GLIBCXX_DEBUG

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

void trace(int x)                         { cerr << x; }
void trace(long x)                        { cerr << x; }
void trace(long long x)                   { cerr << x; }
void trace(unsigned x)                    { cerr << x; }
void trace(unsigned long x)               { cerr << x; }
void trace(unsigned long long x)          { cerr << x; }
void trace(float x)                       { cerr << x; }
void trace(double x)                      { cerr << x; }
void trace(long double x)                 { cerr << x; }
void trace(char x)                        { cerr << '\'' << x << '\''; }
void trace(const char *x)                 { cerr << '\"' << x << '\"'; }
void trace(const string &x)               { cerr << '\"' << x << '\"'; }
void trace(bool x)                        { cerr << (x ? "true" : "false"); }

template <typename A, typename B>                         void trace(const pair <A, B> &x)         { cerr << '{'; trace(x.first); cerr << ','; trace(x.second); cerr << '}'; }
template <typename A, typename B, typename C>             void trace(const tuple <A, B, C> &x)     { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << '}'; }
template <typename A, typename B, typename C, typename D> void trace(const tuple <A, B, C, D> &x)  { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << ','; trace(get <3> (x)); cerr << '}'; }
template <typename T>                                     void trace(const T &x)                   { int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), trace(i); cerr << "}"; }
template <size_t N>                                       void trace(bitset <N> v)                 { cerr << '{'; for (size_t i = 0; i < N; i++) cerr << static_cast <char> ('0' + v[i]); cerr << '}'; }
void _print()                                                                                { cerr << "]\n"; }
template <typename T, typename... V>                      void _print(T t, V... v)                 { trace(t); if (sizeof...(v)) cerr << ", "; _print(v...); }

#ifndef ONLINE_JUDGE
      #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
      #define debug(x...)
#endif // ONLINE_JUDGE

template <typename T> using ordered_set                = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T1, typename T2> using ordered_map  = tree <T1, T2, less <T1>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> T binaryExpo(T a, T p)              { if (p == 0) { return 1LL; } if (p == 1) { return a; } if (p & 1) { return a * binaryExpo(a, p - 1); } T ret = binaryExpo(a, p / 2); return ret * ret; }
template <class T> T bigMod(T a, T p, T m)             { if (p == 0) { return 1LL % m; } if (p == 1) { return a % m; } if (p & 1) { return (a % m * bigMod(a, p - 1, m)) % m; } T ret = bigMod(a, p / 2, m) % m; return (ret * ret) % m; }
template <class T> T modInv(T a, T m)                  { return bigMod(a, m - 2, m); }

template <class T> bool MIN(T &a, T b)                 { return a > b ? (a = b, true) : false; }
template <class T> bool MAX(T &a, T b)                 { return a < b ? (a = b, true) : false; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define ll              long long int
#define ull             unsigned long long int
#define ld              long double
#define endl            '\n'
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define mk              make_pair
#define ff              first
#define ss              second
#define all(a)          (a).begin(), (a).end()
#define rall(a)         (a).rbegin(), (a).rend()
#define eb              emplace_back
#define pb              push_back
#define pf              push_front
#define sz(a)           (int)(a.size())
#define ook             order_of_key             // The number of items in a set that are strictly smaller than k
#define fbo             find_by_order            // It returns an iterator to the i'th largest element
#define ATCODER         if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); }

#define int             long long int

const int maxn = 3e5 + 5;
const int logn = 19;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

void Task() {
      int r, g, b;
      cin >> r >> g >> b;
      multiset <int> aliveRed;
      multiset <int> aliveGreen;
      multiset <int> aliveBlue;
      multiset <pii> alive;
      int RED = 1;
      int GREEN = 2;
      int BLUE = 3;
      for (int i = 1; i <= r; i++) {
            int x;
            cin >> x;
            aliveRed.insert(x);
            alive.insert(mk(x, 1));
      }
      for (int i = 1; i <= g; i++) {
            int x;
            cin >> x;
            aliveGreen.insert(x);
            alive.insert(mk(x, 2));
      }
      for (int i = 1; i <= b; i++) {
            int x;
            cin >> x;
            aliveBlue.insert(x);
            alive.insert(mk(x, 3));
      }
      int area = 0;
      while (alive.size()) {
            debug(alive);
            pii last = *alive.rbegin();
            alive.erase(alive.find(last));
            int x = last.first;
            int color = last.second;
            debug(x, color);
            if (color == RED) {
//                  debug("GB", aliveGreen, aliveBlue);
                  aliveRed.erase(aliveRed.find(x));
                  int maxGreen = 0;
                  if (sz(aliveGreen)) {
                        maxGreen = *aliveGreen.rbegin();
                  }
                  int maxBlue = 0;
                  if (sz(aliveBlue)) {
                        maxBlue = *aliveBlue.rbegin();
                  }
                  int maxi = max(maxGreen, maxBlue);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxGreen > maxBlue) {
                        area += x * maxGreen;
                        aliveGreen.erase(aliveGreen.find(maxGreen));
                        alive.erase(alive.find(mk(maxGreen, GREEN)));
                  }
                  else {
                        area += x * maxBlue;
                        aliveBlue.erase(aliveBlue.find(maxBlue));
                        alive.erase(alive.find(mk(maxBlue, BLUE)));
                  }
            }
            else if (color == GREEN) {
                  aliveGreen.erase(aliveGreen.find(x));
                  int maxRed = 0;
                  if (sz(aliveRed)) {
                        maxRed = *aliveRed.rbegin();
                  }
                  int maxBlue = 0;
                  if (sz(aliveBlue)) {
                        maxBlue = *aliveBlue.rbegin();
                  }
                  int maxi = max(maxRed, maxBlue);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxRed > maxBlue) {
                        area += x * maxRed;
                        aliveRed.erase(aliveRed.find(maxRed));
                        alive.erase(alive.find(mk(maxRed, RED)));
                  }
                  else {
                        area += x * maxBlue;
                        aliveBlue.erase(aliveBlue.find(maxBlue));
                        alive.erase(alive.find(mk(maxBlue, BLUE)));
                  }
            }
            else {
                  aliveBlue.erase(aliveBlue.find(x));
                  int maxRed = 0;
                  if (sz(aliveRed)) {
                        maxRed = *aliveRed.rbegin();
                  }
                  int maxGreen = 0;
                  if (sz(aliveGreen)) {
                        maxGreen = *aliveGreen.rbegin();
                  }
                  int maxi = max(maxRed, maxGreen);
                  if (maxi == 0) {
                        continue;
                  }
                  if (maxRed > maxGreen) {
                        area += x * maxRed;
                        aliveRed.erase(aliveRed.find(maxRed));
                        alive.erase(alive.find(mk(maxRed, RED)));
                  }
                  else {
                        area += x * maxGreen;
                        aliveGreen.erase(aliveGreen.find(maxGreen));
                        alive.erase(alive.find(mk(maxGreen, GREEN)));
                  }
            }
      }
      cout << area << endl;
}

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr); cout.tie(nullptr);
      cout.precision(12);

      bool FILEIO = 0;
      if (FILEIO and fopen("in.txt", "r")) {
            freopen("in.txt", "r", stdin);
      }

      int tc = 1;
      while (tc--) {
            Task();
      }

      #ifndef ONLINE_JUDGE
            cerr << endl << "Time : " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
      #endif // ONLINE_JUDGE
}


#undef _GLIBCXX_DEBUG

#include "bits/stdc++.h"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

void trace(int x)                         { cerr << x; }
void trace(long x)                        { cerr << x; }
void trace(long long x)                   { cerr << x; }
void trace(unsigned x)                    { cerr << x; }
void trace(unsigned long x)               { cerr << x; }
void trace(unsigned long long x)          { cerr << x; }
void trace(float x)                       { cerr << x; }
void trace(double x)                      { cerr << x; }
void trace(long double x)                 { cerr << x; }
void trace(char x)                        { cerr << '\'' << x << '\''; }
void trace(const char *x)                 { cerr << '\"' << x << '\"'; }
void trace(const string &x)               { cerr << '\"' << x << '\"'; }
void trace(bool x)                        { cerr << (x ? "true" : "false"); }

template <typename A, typename B>                         void trace(const pair <A, B> &x)         { cerr << '{'; trace(x.first); cerr << ','; trace(x.second); cerr << '}'; }
template <typename A, typename B, typename C>             void trace(const tuple <A, B, C> &x)     { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << '}'; }
template <typename A, typename B, typename C, typename D> void trace(const tuple <A, B, C, D> &x)  { cerr << '{'; trace(get <0> (x)); cerr << ','; trace(get <1> (x)); cerr << ','; trace(get <2> (x)); cerr << ','; trace(get <3> (x)); cerr << '}'; }
template <typename T>                                     void trace(const T &x)                   { int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), trace(i); cerr << "}"; }
template <size_t N>                                       void trace(bitset <N> v)                 { cerr << '{'; for (size_t i = 0; i < N; i++) cerr << static_cast <char> ('0' + v[i]); cerr << '}'; }
void _print()                                                                                { cerr << "]\n"; }
template <typename T, typename... V>                      void _print(T t, V... v)                 { trace(t); if (sizeof...(v)) cerr << ", "; _print(v...); }

#ifndef ONLINE_JUDGE
      #define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
      #define debug(x...)
#endif // ONLINE_JUDGE

template <typename T> using ordered_set                = tree <T, null_type, less <T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T1, typename T2> using ordered_map  = tree <T1, T2, less <T1>, rb_tree_tag, tree_order_statistics_node_update>;

template <class T> T binaryExpo(T a, T p)              { if (p == 0) { return 1LL; } if (p == 1) { return a; } if (p & 1) { return a * binaryExpo(a, p - 1); } T ret = binaryExpo(a, p / 2); return ret * ret; }
template <class T> T bigMod(T a, T p, T m)             { if (p == 0) { return 1LL % m; } if (p == 1) { return a % m; } if (p & 1) { return (a % m * bigMod(a, p - 1, m)) % m; } T ret = bigMod(a, p / 2, m) % m; return (ret * ret) % m; }
template <class T> T modInv(T a, T m)                  { return bigMod(a, m - 2, m); }

template <class T> bool MIN(T &a, T b)                 { return a > b ? (a = b, true) : false; }
template <class T> bool MAX(T &a, T b)                 { return a < b ? (a = b, true) : false; }

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define ll              long long int
#define ull             unsigned long long int
#define ld              long double
#define endl            '\n'
#define pii             pair <int, int>
#define pll             pair <ll, ll>
#define mk              make_pair
#define ff              first
#define ss              second
#define all(a)          (a).begin(), (a).end()
#define rall(a)         (a).rbegin(), (a).rend()
#define eb              emplace_back
#define pb              push_back
#define pf              push_front
#define sz(a)           (int)(a.size())
#define ook             order_of_key             // The number of items in a set that are strictly smaller than k
#define fbo             find_by_order            // It returns an iterator to the i'th largest element
#define ATCODER         if (fopen("in.txt", "r")) { freopen("in.txt", "r", stdin); }

#define int             long long int

const int maxn = 3e5 + 5;
const int logn = 19;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;

int r;
int g;
int b;
int red[201];
int green[201];
int blue[201];
int dp[205][205][205];

int put(int num) {
      num--;
      return max(0LL, num);
}

int solve(int rp, int gp, int bp) {
      int &ret = dp[rp][gp][bp];
      if (~ret) {
            return ret;
      }
      ret = 0;
      if (rp - 1 >= 0) {
            MAX(ret, solve(rp - 1, gp, bp));
      }
      if (gp - 1 >= 0) {
            MAX(ret, solve(rp, gp - 1, bp));
      }
      if (bp - 1 >= 0) {
            MAX(ret, solve(rp, gp, bp - 1));
      }
      {
            int go = red[rp] * green[gp] + solve(put(rp), put(gp), bp);
            MAX(ret, go);
      }
      {
            int go = red[rp] * blue[bp] + solve(put(rp), gp, put(bp));
            MAX(ret, go);
      }
      {
            int go = green[gp] * blue[bp] + solve(rp, put(gp), put(bp));
            MAX(ret, go);
      }
      debug(rp, gp, bp, ret);
      return ret;
}

void Task() {
      cin >> r >> g >> b;
      for (int i = 1; i <= r; i++) {
            cin >> red[i];
      }
      for (int i = 1; i <= g; i++) {
            cin >> green[i];
      }
      for (int i = 1; i <= b; i++) {
            cin >> blue[i];
      }
      sort(red + 1, red + r + 1);
      sort(green + 1, green + g + 1);
      sort(blue + 1, blue + b + 1);

      memset(dp, -1, sizeof dp);
      cout << solve(r, g, b) << endl;
}

signed main()
{
      ios_base::sync_with_stdio(false);
      cin.tie(nullptr); cout.tie(nullptr);
      cout.precision(12);

      bool FILEIO = 0;
      if (FILEIO and fopen("in.txt", "r")) {
            freopen("in.txt", "r", stdin);
      }

      int tc = 1;
      while (tc--) {
            Task();
      }

      #ifndef ONLINE_JUDGE
            cerr << endl << "Time : " << 1.0 * clock() / CLOCKS_PER_SEC << " s." << endl;
      #endif // ONLINE_JUDGE
}