#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
//英语 看博友注释 抄博友程序 加减乘除 背
struct nod{
int zi;
int mu;
}da[4];
int a[4];
int e;
void get()
{
for(int i=0;i<4;i++)
{
da[i].zi=a[i];
da[i].mu=1;
}
}
nod op(nod a,nod b,int i)
{
nod c;
if(i==0)//+
{
c.mu=a.mu*b.mu;
c.zi=a.zi*b.mu+b.zi*a.mu;
}else if(i==1)//-
{
c.mu=a.mu*b.mu;
c.zi=a.zi*b.mu-b.zi*a.mu;
}else if(i==2)//*
{
c.mu=a.mu*b.mu;
c.zi=a.zi*b.zi;
}else if(i==3)// /
{
c.mu=a.mu*b.zi;
c.zi=a.zi*b.mu;
}
return c;
}
int flag;
int fun()
{
//(((a#b)#c)#d)
for(int i=0;i<4;i++)
{
if(i==3 && da[1].zi==0)
{
continue;
}
nod t1=op(da[0],da[1],i);
for(int j=0;j<4;j++)
{
if(j==3 && da[2].zi==0)
{
continue;
}
nod t2=op(t1,da[2],j);
for(int k=0;k<4;k++)
{
if(k==3 && da[3].zi==0)
{
continue;
}
nod t3=op(t2,da[3],k);
if(t3.zi/t3.mu==e&& t3.zi%t3.mu==0)
{
return 1;
}
}
}
}
//(a#b)#(c#d) 必需
for(int i=0;i<4;i++)
{
if(i==3 && da[1].zi==0)
{
continue;
}
nod t1=op(da[0],da[1],i);
for(int j=0;j<4;j++)
{
if(j==3 && da[3].zi==0)
{
continue;
}
nod t2=op(da[2],da[3],j);
for(int k=0;k<4;k++)
{
if(k==3 && t2.zi==0)
{
continue;
}
nod t3=op(t1,t2,k);
if(t3.zi/t3.mu==e&& t3.zi%t3.mu==0)
{
return 1;
}
}
}
}
//a#(b#(c#d)) 必需
for(int i=0;i<4;i++)
{
if(i==3 && da[3].zi==0)
{
continue;
}
nod t1=op(da[2],da[3],i);
for(int j=0;j<4;j++)
{
if(j==3 && t1.zi==0)
{
continue;
}
nod t2=op(da[1],t1,j);
for(int k=0;k<4;k++)
{
if(k==3 && t2.zi==0)
{
continue;
}
nod t3=op(da[0],t2,k);
if(t3.zi/t3.mu==e&& t3.zi%t3.mu==0)
{
return 1;
}
}
}
}
return 0;
}
int main()
{
while(1)
{
cin>>a[0];
if(a[0]==-1)
{
break;
}
cin>>a[1]>>a[2]>>a[3]>>e;
cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<" "<<e;
flag=0;
sort(a,a+4);
do{
get();
if(fun())
{
flag=1;
break;
}
}while(next_permutation(a,a+4));
if(flag==1)
{
cout<<" OK!"<<endl;
}else
{
cout<<" NO!"<<endl;
}
}
return 0;
}