#include using namespace std; #define rep(i,a,b) for(int i=a;i= mod1) { r[i][j] -= mod1; } } return r; } Mat1& operator*=(const Mat1& b) { return *this = *this * b; } Mat1 operator*(const Mat1& b) { Mat1 r; rep(i, 0, 2) rep(j, 0, 2) { rep(k, 0, 2) { r[i][j] += a[i][k] * b[k][j]; } r[i][j] %= mod1; } return r; } Mat1 power(int n) { if (n == 0) return Mat1::One(); if (n == 1) return *this; Mat1 t = power(n / 2); t = t * t; if (n % 2) { t = t * *this; } return t; } void print() { rep(i, 0, 2) { cout << "[" << a[i][0] << ", " << a[i][1] << "]" << endl; } cout << endl; } bool empty() { return a[0][0] == 1 && a[0][1] == 0 && a[1][0] == 0 && a[1][1] == 1; } void clear() { *this = Mat1::One(); } }; ll N; //----------------------------------------------------------------- int main() { cin >> N; if (N == 1) { printf("1\n1\n"); return 0; } Mat1 m; m.a[0][0] = 100; m.a[0][1] = 1; m.a[1][0] = 0; m.a[1][1] = 1; m = m.power(N - 1); ll ans = (m.a[0][0] + m.a[0][1]) % mod1; cout << ans << endl; string s = "1"; rep(i, 0, N - 1) s += "01"; int mag = 21; if (s.length() < 21) { cout << s << endl; return 0; } if (s.length() % 21 == 0) { cout << 0 << endl; return 0; } if (s.length() % 22 == 0) { cout << 0 << endl; return 0; } int cnt = s.length() / 22 * 22; string sa = s.substr(cnt); cout << sa << endl; //101010101010101010101 }