const ll maxn = 10;
struct Matrix {
ld a[maxn][maxn];
int n;
Matrix (int sz, int kind) {
this->n = sz;
for (int i = 0; i < sz; i ++) {
for (int j = 0; j < sz; j ++) {
a[i][j] = 0;
}
}
for (int i = 0; i < sz; i ++) {
a[i][i] = kind;
}
}
Matrix operator*(Matrix rhs)const {
Matrix ret(N - 1, 0);
for (int i = 0; i < n; i ++) {
for (int j = 0; j < n; j ++) {
for (int k = 0; k < n; k ++) {
ret.a[i][j] += a[i][k] * rhs.a[k][j];
}
}
}
return ret;
}
void out() {
for (int i = 0; i < 5 ;i ++) {
for (int j = 0; j < 5; j ++) {
cout << a[i][j] << " ";
}
cout << endl;
}
}
} A(maxn - 1, 0);
Matrix q_pow( int k) {//注意不要带矩阵参数很容易爆栈
Matrix ret = {N - 1, 1};
Matrix x = A;
while (k) {
if (k & 1) {
ret = ret * x;
}
k >>= 1;
x = x * x;
}
return ret;
}