# 思路

$$x\otimes 3x=2x$$等价于$$x \otimes 2x=3x$$

# 代码

#include<cstring>
#include<cstdio>
#include<iostream>
#include<cstdlib>
#include<cmath>
#include<ctime>
#include<bitset>
using namespace std;
typedef long long ll;
const int mod = 1e9 + 7;
ll x=0,f=1;char c=getchar();
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;
}
namespace BF1 {
int a[100],tot;
ll f[100][2][2];
ll dfs(int pos,int limit,int lst) {
if(pos == 0) return 1;
if(f[pos][limit][lst]) return f[pos][limit][lst];
if(limit) {
if(a[pos] == 0) f[pos][limit][lst] += dfs(pos - 1,1,0);
else {
f[pos][limit][lst] += dfs(pos - 1,0,0);
if(!lst) f[pos][limit][lst] += dfs(pos - 1,1,1);
}
}
else {
f[pos][limit][lst] += dfs(pos - 1,0,0);
if(!lst) f[pos][limit][lst] += dfs(pos - 1,0,1);
}
return f[pos][limit][lst];
}
void solve(ll x) {
tot = 0;
while(x) {
a[++tot] = x & 1;
x >>= 1;
}
memset(f,0,sizeof(f));
printf("%lld\n",dfs(tot,1,0) - 1);
}
}
namespace BF2 {

struct node {
ll a[10][10];
int n,m;
node() {
memset(a,0,sizeof(a));n = 0,m = 0;
}
node(int x,int y) {
n = x,m = y;
memset(a,0,sizeof(a));
}
node(int nn) {
n = m = nn;
memset(a,0,sizeof(a));
for(int i = 1;i <= nn;++i) a[i][i] = 1;
}
};
node operator * (const node &x,const node &y) {
int n = x.n,m = y.m,K = x.m;
node ret(n,m);
for(int k = 1;k <= K;++k)
for(int i = 1;i <= n;++i)
for(int j = 1;j <= m;++j)
ret.a[i][j] += x.a[i][k] * y.a[k][j] % mod,ret.a[i][j] %= mod;
return ret;
}
node operator ^ (node x,ll y) {
node ret(x.n);
for(;y;y >>= 1,x = x * x)
if(y & 1) ret = x * ret;
return ret;
}
void solve(ll n) {
node A(1,2);
A.a[1][1] = A.a[1][2] = 1;
node C(2,2);
C.a[1][1] = C.a[1][2] = C.a[2][1] = 1;
A = A * (C ^ n);
printf("%lld\n",A.a[1][1]);
}
}
int main() {