# 3329: Xorequ

$$x\oplus 2x = 3x$$ 不就是 $$x\oplus (x<<1) = (x<<1)+x$$

$$f[i][0/1]$$i个数第i个是0/1的方案数
$$f[i][0]=f[i-1][1]+f[i-1][0],\ f[i][1]=f[i-1][0]$$

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
const int N=65;
const ll P=1e9+7;
char c=getchar();ll x=0,f=1;
while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}
while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
return x*f;
}

int a[N], len;
ll n, f[N][2];
ll dfs(int d, int last, int sky) { //printf("dfs %d %d %d\n",d,last,sky);
if(d==0) return 1;
if(!sky && f[d][last]!=-1) return f[d][last];
int lim = sky ? a[d] : 1;
ll now=0;
now += dfs(d-1, 0, sky && 0==lim);
if(last!=1 && 1<=lim) now += dfs(d-1, 1, sky && 1==lim);
return sky ? now : f[d][last]=now;
}

struct Meow{
ll a[2][2];
Meow(){memset(a,0,sizeof(a));}
void ini(){a[0][0]=a[1][1]=1;}
ll* operator [](int x) {return a[x];}
};
inline void mod(ll &x) {if(x>=P) x-=P;}
Meow operator *(Meow a, Meow b) {
Meow c;
for(int i=0; i<2; i++)
for(int k=0; k<2; k++) if(a[i][k])
for(int j=0; j<2; j++) if(b[k][j])
mod(c[i][j] += a[i][k]*b[k][j]%P);
return c;
}
Meow operator ^(Meow a, ll b) {
Meow ans; ans.ini();
for(; b; b>>=1, a=a*a)
if(b&1) ans=ans*a;
return ans;
}
int main() {
freopen("in","r",stdin);
memset(f,-1,sizeof(f));