#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

bool isAbundant(int number)
{
    int sum=0;
    for(int i=1; i<number; i++)
    {
        if(!(number%i))
            sum+=i;
    }

    if(sum>number)
        return true;
    else
        return false;
}


int main()
{
    unsigned long long int result=0;
    std::vector < unsigned int > abudant_sums;
    std::vector < unsigned int > abudant_numbers;

    for(int i=0; i<=28123;i++)
    {
        if(isAbundant(i))
            abudant_numbers.push_back(i);
    }

    for(int i=0; i<abudant_numbers.size(); i++)
    {
        for(int j=i; j<abudant_numbers.size(); j++)
        {
            if(abudant_numbers[i] + abudant_numbers[j] <= 28123 )
                abudant_sums.push_back(abudant_numbers[i]+abudant_numbers[j]);
            else
                break;
        }
    }

    sort(abudant_sums.begin(), abudant_sums.end());
    abudant_sums.erase( unique( abudant_sums.begin(), abudant_sums.end() ), abudant_sums.end() );

    for(int i=0; i<28123; i++)
    {
        if(!(find(abudant_sums.begin(), abudant_sums.end(), i) != abudant_sums.end()))
            result = result+i;
    }

    cout << result << endl;

    return 0;
}