#include<iostream>
#include<cmath>
#include<math.h>
#include<string>
#include <cctype>
#include <iomanip>
using namespace std;
int main()
{
	int x,y,z,w,a,ta,vol;
	freopen("DATA3.txt","r",stdin); 
	freopen("OUT3.txt","w",stdout);
	for(w=0;w<5;x++)
	{
		cin >> vol;
		a=100000000;
		for(x=1;x<int(ceil(vol/2.75))+3;x++)
		{
			for(y=1;y<int(ceil(vol/4))+3;y++)
			{
				for(z=1;z<int(ceil(vol/5))+3;z++)
				{
					if(x*y*z==vol)
					{
						ta=(x*y+x*z+y*z)*2;
						if(ta<a)
							a=ta;
					}
					if(z>x)
						break;
				}
			}
		}
		cout << a << endl;
	}
	return(0);
}

