#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int32_t n; cin >> n; vector d(10); for (auto i = 0; i < 10; ++i) { d[i] = i; } do { int32_t x, y, z; if (n == 1) { x = d[0] * 100 + d[1] * 10 + d[2]; y = d[3] * 100 + d[4] * 10 + d[5]; z = d[1] * 1000 + d[6] * 100 + d[2] * 10 + d[1]; } else if (n == 2) { x = d[0] * 1000 + d[0] * 100 + d[1] * 10 + d[2]; y = d[3] * 1000 + d[4] * 100 + d[5] * 10 + d[6]; z = d[7] * 10000 + d[8] * 1000 + d[1] * 100 + d[2] * 10 + d[9]; } else if (n == 3) { x = d[0] * 100000 + d[1] * 10000 + d[2] * 1000 + d[3] * 100 + d[4] * 10 + d[5]; y = d[6] * 10000 + d[3] * 1000 + d[5] * 100 + d[7] * 10 + d[8]; z = d[1] * 100000 + d[3] * 10000 + d[9] * 1000 + d[4] * 100 + d[3] * 10 + d[9]; } if (x + y == z) { cout << z << endl; return 0; } } while (next_permutation(d.begin(), d.end())); return 0; }