#include using namespace std; int main() { int V; cin >> V; int ans = 4 * V + 2; for (int d1 = 1; d1 * d1 * d1 <= V; ++d1) if (V % d1 == 0) for (int d2 = d1; d1 * d2 * d2 <= V; ++d2) if (V % (d1 * d2) == 0) { int d3 = V/d1/d2; ans = min(ans, 2 * (d1*d2 + d1*d3 + d2*d3)); } cout << ans << endl; return 0; }