#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld =long double;
const ld eps = 1e-9;

bool solve(bitset<18>bs, vector<vector<int>>&dp,const vector<pair<int,int>>&vs,const int now) {
	if(dp[now][bs.to_ulong()]!=-1)return dp[now][bs.to_ulong()];

	bool ok = false;
	if(bs.count()==vs.size())ok=true;
	else {
		for (int i = 0; i < vs.size(); ++i) {
			if (bs[i]) {

			}
			else {
				if (vs[i].first == now || now == 7) {
					bs[i] = true;
					bool aok = solve(bs, dp, vs, vs[i].second);
					if (aok)ok = true;
					bs[i] = false;
				}
				if (vs[i].second == now || now == 7) {
					bs[i] = true;
					bool aok = solve(bs, dp, vs, vs[i].first);
					if(aok)ok=true;
					bs[i] = false;
				}
			}
		}
	
	}
	return dp[now][bs.to_ulong()]=ok;
}
int main()
{
	long long int N;
	while (cin >> N) {
		if(!N)break;
		N/=2;
		vector<int>v;
		v.push_back(N);
		long long int ans=N;
		long long int x=1;
		for (; x < sqrt(N); ++x) {
			v.push_back((N+x-1)/x);
			ans+=(N+x-1)/x;
		}

		for (long long int y = sqrt(N)+1; y >= 2; --y) {
			long long int l=(N+y-1)/y;
			long long int r=(N+y-2)/(y-1);
			l=max(l,x);

			ans+=static_cast<long long int>(y)*(r-l);
			/*for (int k = l; k < r; ++k) {
				v.push_back(y);
			}*/
		}
		ans*=8;
		ans+=4*N*4;
		cout<<ans<<endl;
		
	}
	return 0;
}
