#include <vector>
#include <string>
#include <iostream>
#include <iomanip>
#include <array>
using namespace std;
array<array<int,10>,10> Cardano(unsigned long long n)
{
array<array<int,10>,10> m;
for(int i = 0; i < 10; ++i)
for(int j = 0; j < 10; ++j)
m[i][j] = 0;
for(int i = 0; i < 25; ++i)
{
int q = n&0x3;
n >>= 2;
int rr = i/5, cc = i%5, r, c;
switch(q)
{
case 0: r = rr; c = cc; break;
case 1: r = cc; c = 9 - rr; break;
case 2: r = 9 - rr; c = 9 - cc; break;
case 3: r = 9 - cc; c = rr; break;
}
m[r][c] = 1;
}
return m;
}
int main()
{
unsigned long long No = 1037896401234567ull;
auto L = Cardano(No);
for(auto r: L)
{
for(auto c: r) cout << c;
cout << endl;
}
}
I2luY2x1ZGUgPHZlY3Rvcj4KI2luY2x1ZGUgPHN0cmluZz4KI2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW9tYW5pcD4KI2luY2x1ZGUgPGFycmF5PgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmFycmF5PGFycmF5PGludCwxMD4sMTA+IENhcmRhbm8odW5zaWduZWQgbG9uZyBsb25nIG4pCnsKICAgIGFycmF5PGFycmF5PGludCwxMD4sMTA+IG07CgogICAgZm9yKGludCBpID0gMDsgaSA8IDEwOyArK2kpCiAgICAgICAgZm9yKGludCBqID0gMDsgaiA8IDEwOyArK2opCiAgICAgICAgICAgIG1baV1bal0gPSAwOwoKCiAgICBmb3IoaW50IGkgPSAwOyBpIDwgMjU7ICsraSkKICAgIHsKICAgICAgICBpbnQgcSA9IG4mMHgzOwogICAgICAgIG4gPj49IDI7CiAgICAgICAgaW50IHJyID0gaS81LCBjYyA9IGklNSwgciwgYzsKICAgICAgICBzd2l0Y2gocSkKICAgICAgICB7CiAgICAgICAgY2FzZSAwOiByID0gcnI7IGMgPSBjYzsgICAgICAgICBicmVhazsKICAgICAgICBjYXNlIDE6IHIgPSBjYzsgYyA9IDkgLSBycjsgICAgIGJyZWFrOwogICAgICAgIGNhc2UgMjogciA9IDkgLSBycjsgYyA9IDkgLSBjYzsgYnJlYWs7CiAgICAgICAgY2FzZSAzOiByID0gOSAtIGNjOyBjID0gcnI7ICAgICBicmVhazsKICAgICAgICB9CiAgICAgICAgbVtyXVtjXSA9IDE7CiAgICB9CiAgICByZXR1cm4gbTsKfQoKCgppbnQgbWFpbigpCnsKCXVuc2lnbmVkIGxvbmcgbG9uZyBObyA9IDEwMzc4OTY0MDEyMzQ1Njd1bGw7CiAgICBhdXRvIEwgPSBDYXJkYW5vKE5vKTsKICAgIGZvcihhdXRvIHI6IEwpCiAgICB7CiAgICAgICAgZm9yKGF1dG8gYzogcikgY291dCA8PCBjOwogICAgICAgIGNvdXQgPDwgZW5kbDsKICAgIH0KfQo=