mod=10**9+7 N=int(input()) from functools import lru_cache @lru_cache(maxsize=None) def calc(keta,rest,key): rest=min(rest,(1<<(keta+1))-1) if key==2 and keta==-1: return 1 if keta==-1: return 0 ANS=0 if key==0: if rest>=(1<=(1<=(1<