import java.util.*;
import java.lang.*;
import java.io.*;
class A
{
{
Scanner in
= new Scanner
(System.
in); int n;
while (in.hasNextInt()) {
n = in.nextInt();
int[] seg = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
for (int i = 0; i < 24; i++)
for (int j = 0; j < 60; j++) {
int a = 0;
a = a + seg[i / 10];
a = a + seg[i % 10];
a = a + seg[j / 10];
a = a + seg[j % 10];
if (a == n) {
if (i
< 10) System.
out.
printf("0%d", i
); if (j
< 10) System.
out.
printf("0%d", j
); return;
}
}
System.
out.
print("Impossible"); }
in.close();
return;
}
}
aW1wb3J0IGphdmEudXRpbC4qOwppbXBvcnQgamF2YS5sYW5nLio7CmltcG9ydCBqYXZhLmlvLio7CiAKY2xhc3MgQQp7CglwdWJsaWMgc3RhdGljIHZvaWQgbWFpbiAoU3RyaW5nW10gYXJncykgdGhyb3dzIGphdmEubGFuZy5FeGNlcHRpb24KCXsKCQlTY2FubmVyIGluID0gbmV3IFNjYW5uZXIoU3lzdGVtLmluKTsKCQlpbnQgbjsKCQl3aGlsZSAoaW4uaGFzTmV4dEludCgpKSB7CgkJCW4gPSBpbi5uZXh0SW50KCk7CgkJCWludFtdIHNlZyA9IHs2LCAyLCA1LCA1LCA0LCA1LCA2LCAzLCA3LCA2fTsKCQkJZm9yIChpbnQgaSA9IDA7IGkgPCAyNDsgaSsrKQoJCQkJZm9yIChpbnQgaiA9IDA7IGogPCA2MDsgaisrKSB7CgkJCQkJaW50IGEgPSAwOwoJCQkJCWEgPSBhICsgc2VnW2kgLyAxMF07CgkJCQkJYSA9IGEgKyBzZWdbaSAlIDEwXTsKCQkJCQlhID0gYSArIHNlZ1tqIC8gMTBdOwoJCQkJCWEgPSBhICsgc2VnW2ogJSAxMF07CgkJCQkJaWYgKGEgPT0gbikgewoJCQkJCQlpZiAoaSA8IDEwKSBTeXN0ZW0ub3V0LnByaW50ZigiMCVkIiwgaSk7CgkJCQkJCWVsc2UgU3lzdGVtLm91dC5wcmludChpKTsKCQkJ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