#include<stdio.h>
long long int Solve(long long int);
int memo[1001]={0};
int main()
{
long long int n;
return 0;
}
long long int Solve(long long int n)
{
long long int sum=0;
if(n <= (n/2+n/3+n/4))
{
if(n<=1000)
{
if(memo[n]==0)
{
sum=Solve(n/2)+Solve(n/3)+Solve(n/4);
memo[n]=sum;
return sum;
}
else
{
sum=memo[n];
return sum;
}
}
else
{
sum=Solve(n/2)+Solve(n/3)+Solve(n/4);
return sum;
}
}
else
return n;
}
I2luY2x1ZGU8c3RkaW8uaD4KCmxvbmcgbG9uZyBpbnQgU29sdmUobG9uZyBsb25nIGludCk7CgppbnQgbWVtb1sxMDAxXT17MH07CgppbnQgbWFpbigpCnsKICAgIGxvbmcgbG9uZyBpbnQgbjsKCiAgICBzY2FuZigiJWxsZCIsJm4pOwogICAgcHJpbnRmKCIlbGxkIixTb2x2ZShuKSk7CiAgICByZXR1cm4gMDsKfQoKbG9uZyBsb25nIGludCBTb2x2ZShsb25nIGxvbmcgaW50IG4pCnsKICAgIGxvbmcgbG9uZyBpbnQgc3VtPTA7CgogICAgaWYobiA8PSAobi8yK24vMytuLzQpKQogICAgewogICAgICAgIGlmKG48PTEwMDApCiAgICAgICAgewogICAgICAgICAgICBpZihtZW1vW25dPT0wKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdW09U29sdmUobi8yKStTb2x2ZShuLzMpK1NvbHZlKG4vNCk7CiAgICAgICAgICAgICAgICBtZW1vW25dPXN1bTsKICAgICAgICAgICAgICAgIHJldHVybiBzdW07CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBzdW09bWVtb1tuXTsKICAgICAgICAgICAgICAgIHJldHVybiBzdW07CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgZWxzZQogICAgICAgIHsKICAgICAgICAgICAgc3VtPVNvbHZlKG4vMikrU29sdmUobi8zKStTb2x2ZShuLzQpOwogICAgICAgICAgICByZXR1cm4gc3VtOwogICAgICAgIH0KCiAgICB9CgoKICAgIGVsc2UKICAgICAgICByZXR1cm4gbjsKCn0K