#include<iostream>
#include<algorithm>
using namespace std;
const int N = 25e5 + 10;
struct s
{
int s, c, d;
}sum[N];
bool cmp(s t1, s t2)
{
if (t1.s != t2.s)return t1.s < t2.s;
if (t1.c != t2.c)return t1.c < t2.c;
if (t1.d != t2.d)return t1.d < t2.d;
}
int m;
int main()
{
int n; cin >> n;
for (int c = 0; c * c <= n; c++)
for (int d = c; d * d + c * c <= n; d++)sum[m++] = { c * c + d * d,c,d };
//为防止重复,d必须从c开始循环
sort(sum, sum + m, cmp);
for (int a = 0; a*a <= n; a++)
for (int b = 0; b * b + a * a <= n; b++)
{
int t = n - a * a - b * b;
int l = 0, r = m - 1;
while (l < r)
{
int mid = (l + r) / 2;
if (sum[mid].s >= t)
r = mid;
else
l = mid + 1;
}
if (sum[l].s == t)
{
cout << a << ' ' << b << ' ' << sum[l].c << ' ' << sum[l].d << endl;
return 0;
}
}
return 0;
}