#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
#define LMT 100
bool
isNontrivial(int e, int d, int *pe, int *pd)
{
if (d%10 == 0 && d%10 == 0)
{
return false;
}
int tmpe, tmpd;
if (e/10 == d/10)
{
tmpe = e%10;
tmpd = d%10;
}
else if (e%10 == d/10)
{
tmpe = e/10;
tmpd = d%10;
}
else if (e/10 == d%10)
{
tmpe = e%10;
tmpd = d/10;
}
else if (e%10 == d%10)
{
tmpe = e%10;
tmpd = d%10;
}
else
{
return false;
}
float a1 = (float)e / (float)d;
float a2 = (float)tmpe / (float)tmpd;
if (a1 == a2)
{
*pe = tmpe;
*pd = tmpd;
return true;
}
else
{
return false;
}
return false;
}
int
main(int argc, char **argv)
{
vector<int> ve, vd;
for (int d = 10; d < LMT; d++)
{
for (int e = 10; e < d; e++)
{
int tmpe, tmpd;
if (isNontrivial(e, d, &tmpe, &tmpd))
{
ve.push_back(tmpe);
vd.push_back(tmpd);
}
}
}
int e = 1, d = 1;
for (vector<int>::iterator it = ve.begin(), end = ve.end(); it != end; it++)
{
e *= *it;
}
for (vector<int>::iterator it = vd.begin(), end = vd.end(); it != end; it++)
{
d *= *it;
}
cout << d/e << endl;
return 0;
}