#includeusing namespace std;typedef long long ll;typedef vector Vec;typedef vector Mat;const int N = 55;const int INF = 0x3f3f3f3f;const int MOD = 1e9 + 7;int n, m;int a[N];int dp[N][N];bool judge(int x, int y) { char p[15], q[15]; sprintf(p, "%d", x); sprintf(q, "%d", y); int lenp = strlen(p), lenq = strlen(q); for (int i=0; i = 2) return true; } return false;}void add_mod(ll &a, ll b) { a += b; if (a >= MOD) a -= MOD;} Mat matrix_mul(const Mat &A, const Mat &B) { Mat ret(A.size(), Vec(B[0].size())); for (int i=0; i >=1) { if (n & 1) ret = matrix_mul(ret, X); X = matrix_mul(X, X); } return ret;}Mat get_base() { Mat ret(n, Vec(n)); for (int i=0; i