#include<bits/stdc++.h>
using namespace std;
string tab[2005];
int ile[2005];
int sito[2005];
int main()
{
sito[1] = 1;
sito[0] = 1;
for(int i = 2;i <= 2000;++i)
{
if(sito[i] == 0)
{
for(int j = i;j <= 2000;j += i)
{
sito[j] = i;
}
}
}
tab[1] = "";
string slo;
for(int i = 2;i <= 2000;++i)
{
slo = "";
vector<int> czyn(11);
int x= i;
while(x > 1)
{
czyn[sito[x]]++;
x /= sito[x];
//cout << 1;
}
while(czyn[2]%3 == 0 && czyn[2] >= 3)
{
ile[i]++;
slo += "8[";
czyn[2] -= 3;
}
while(czyn[2]%2 == 0 && czyn[2] >= 2)
{
ile[i]++;
slo += "4[";
czyn[2] -= 2;
}
while(czyn[2] > 0)
{
ile[i]++;
slo += "2[";
czyn[2]--;
}
while(czyn[3]%2 == 0 && czyn[3] >= 2)
{
ile[i]++;
slo += "9[";
czyn[3] -= 2;
}
while(czyn[3] > 0)
{
ile[i]++;
slo += "3[";
czyn[3]--;
}
while(czyn[5] > 0)
{
ile[i]++;
slo += "5[";
czyn[5]--;
}
while(czyn[7] > 0)
{
ile[i]++;
slo += "7[";
czyn[7]--;
}
tab[i] = slo;
}
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cmluZyB0YWJbMjAwNV07CmludCBpbGVbMjAwNV07CmludCBzaXRvWzIwMDVdOwoKCgoKaW50IG1haW4oKQp7CglzaXRvWzFdID0gMTsKCXNpdG9bMF0gPSAxOwoJZm9yKGludCBpID0gMjtpIDw9IDIwMDA7KytpKQoJewoJCWlmKHNpdG9baV0gPT0gMCkKCQl7CgkJCWZvcihpbnQgaiA9IGk7aiA8PSAyMDAwO2ogKz0gaSkKCQkJewoJCQkJc2l0b1tqXSA9IGk7CgkJCX0KCQl9Cgl9Cgl0YWJbMV0gPSAiIjsKCXN0cmluZyBzbG87Cglmb3IoaW50IGkgPSAyO2kgPD0gMjAwMDsrK2kpCgl7CgkJc2x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