#include<stdio.h>
#include<math.h>
long i, j, a, b, c, k, nr, nra, nrc, da[10/*0001*/], nda[10/*0001*/], dc[10/*0001*/], ndc[10/*0001*/];
FILE *fin, *fout;
int main()
{
fin = fopen("ecuatie.in", "rt");
fout = fopen("ecuatie.out", "wt");
fscanf(fin, "%ld%ld%ld%ld", &a, &b, &c, &k);
if(a < 0)
{
da[1] = -a;
nda[1] = a;
}
else
{
da[1] = a;
nda[1] = -a;
}
nra = 1;
if(c < 0)
{
dc[1] = -c;
ndc[1] = c;
}
else
{
dc[1] = c;
ndc[1] = -c;
}
nrc = 1;
for(long x = abs(a / 2); x >= 1; x--)
if(a % x == 0)
{
nra++;
da[nra] = x;
nda[nra] = -x;
}
for(x = abs(c / 2); x >= 1; x--)
if(c % x == 0)
{
nrc++;
dc[nrc] = x;
ndc[nrc] = -x;
}
long nr = 0;
for(i = 1; i <= nra; i++)
{
long cta = a / nda[i];
for(j = 1; j <= nrc; j++)
{
long ctc = c / ndc[j];
if(a + c == -b)
{
nr++;
if(nr == k)
{
fprintf(fout, "(");
if(nda[i] == 1)
fprintf(fout, "x");
else
{
if(nda[i] == -1)
fprintf(fout, "-x");
else
fprintf(fout, "%ldx", nda[i]);
}
if(ndc[j] < 0)
fprintf(fout, "-%ld", ndc[j] * (-1));
else
fprintf(fout, "+%ld", ndc[j]);
fprintf(fout, ")(");
if(cta == 1)
fprintf(fout, "x");
else
{
if(cta == -1)
fprintf(fout, "-x");
else
fprintf(fout, "%ldx", cta);
}
if(ctc < 0)
fprintf(fout, "-%ld", ctc * (-1));
else
fprintf(fout, "+%ld", ctc);
fprintf(fout, ")\n");
break;
}
}
}
}
return 0;
}