#include #include using namespace std; typedef long long LL; int main(int argc, char *argv[]) { LL n; cin >> n; LL a = n / 1000; LL u = 3 * a * a; LL l = 3 * 2 * n * (n % 1000); u += l / 1000000; l %= 1000000; if (n > 100000000) { printf("%06lld\n", n / 1000); } else if (u > 0) { printf("%lld%06lld\n", u, l); } else { printf("%lld\n", l); } return 0; }