#include <iostream>
using namespace std;
int main() {
int n;
while (cin >> n) {
int seg[10] = {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) cout << '0' << i;
else cout << i;
cout << ':';
if (j < 10) cout << '0' << j;
else cout << j;
return 0;
}
}
cout << "Impossible";
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaW50IG1haW4oKSB7CglpbnQgbjsKIAoJd2hpbGUgKGNpbiA+PiBuKSB7CgkJaW50IHNlZ1sxMF0gPSB7NiwgMiwgNSwgNSwgNCwgNSwgNiwgMywgNywgNn07CgkJZm9yIChpbnQgaSA9IDA7IGkgPCAyNDsgaSsrKQoJCQlmb3IgKGludCBqID0gMDsgaiA8IDYwOyBqKyspIHsKCQkJCWludCBhID0gMDsKCQkJCWEgPSBhICsgc2VnW2kgLyAxMF07CgkJCQlhID0gYSArIHNlZ1tpICUgMTBdOwoJCQkJYSA9IGEgKyBzZWdbaiAvIDEwXTsKCQkJCWEgPSBhICsgc2VnW2ogJSAxMF07CgkJCQlpZiAoYSA9PSBuKSB7CgkJCQkJaWYgKGkgPCAxMCkgY291dCA8PCAnMCcgPDwgaTsKCQkJCQllbHNlIGNvdXQgPDwgaTsKCQkJCQljb3V0IDw8ICc6JzsKCQkJCQlpZiAoaiA8IDEwKSBjb3V0IDw8ICcwJyA8PCBqOwoJCQkJCWVsc2UgY291dCA8PCBqOwoJCQkJCXJldHVybiAwOwoJCQkJfQoJCQl9CgkJCWNvdXQgPDwgIkltcG9zc2libGUiOwoJfQp9