#includeusing namespace std;#define fi first#define se second#define mp make_pair#define pb push_back#define rep(i, a, b) for(int i=(a); i<(b); i++)#define sz(x) (int)x.size()#define de(x) cout<< #x<<" = "< < pii;typedef vector vi;const int P=1e9+7;int n, k;int a[33];ll f[33][33][2], pw[33];void upd(ll &a, ll b) { a+=b; if(a>=P) a-=P;}void init() { pw[0]=1; rep(i,1,33) pw[i]=pw[i-1]*2%P;}int main() { init(); while(~scanf("%d",&k)) { n=0; while(k) { a[++n]=(k&1); k>>=1; } for(int l=1, r=n;l