/*
这四个数都小于等于根号n
模拟哈希表,记录c^2 + d^2 的值
*/
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
const int N = 5e6 + 10;
int n;
int C[N], D[N];
int main()
{
cin >> n;
// 都设置为-1
memset(C, -1, sizeof C);
// d从c开始,保证记录的值为升序
for(int c = 0; c * c <= n; c++)
for(int d = c; d * d + c * c <= n; d++)
{
int s = c * c + d * d;
if(C[s] == -1)
{
C[s] = c;
D[s] = d;
}
}
for(int a = 0; a * a <= n; a++)
for(int b = a; b * b + a * a <= n; b++)
{
int s = n - a * a - b * b;
if(C[s] != -1)
{
printf("%d %d %d %d\n", a, b, C[s], D[s]);
return 0;
}
}
return 0;
}