#include <iostream>
using namespace std;
const int MAXN = 100005;
int arr[100010];
long long p;
int main()
{
while (cin >> p)
{
if (p == 0)
break;
if (p == 2)
cout << "Impossible" << endl;
else
{
for (int i = 1; i < p; i++)
arr[i] = 1;
for (long long i = 1; i < p; i++)
arr[i * i % p] = 0;
for (int i = 1; i < p; i++)
cout << arr[i];
cout << endl;
}
}
return 0;
}