#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;
int main() {
srand(time(NULL));
int a, b, c, d, e, tmp;
bool chota = false, chotb = false, chotc = false, chotd = false, chote = false;
for(int i = 1; i<10;i++)
{
a = i;
if (a % 2 == 0)
{
chota = true;
}
for (int f = 1; f < 10; f++)
{
b = f;
if (b % 2 == 0)
{
chotb = true;
}
for (int j = 1; j < 10; j++)
{
c = j;
if (c % 2 == 0)
{
chotc = true;
}
for (int k =1; k < 10; k++)
{
d = k;
if (d % 2 == 0)
{
chotd = true;
}
for (int l = 1; l < 10; l++)
{
e = l;
if (e % 2 == 0)
{
chote = true;
}
if (chota == false && chotb == false && chotc == false && chotd == true && chote == true)
{
if (a*b*c == e + d)
{
tmp = a * 10000 + b * 1000 + c * 100 + d * 10 + e;
cout << tmp << endl;
}
}
if (chota == false && chotb == false && chotc == true && chotd == true && chote == true)
{
if (a*b == c + e + d)
{
tmp = a * 10000 + b * 1000 + c * 100 + d * 10 + e;
cout << tmp << endl;
}
}
if (chota == false && chotb == false && chotc == true && chotd == true && chote == false)
{
if (a*b*e == c + d)
{
tmp = a * 10000 + b * 1000 + c * 100 + d * 10 + e;
cout << tmp << endl;
}
}
}
}
}
}
}
system("PAUSE");
return 0;
}