n=int(input())
a=list(map(int,input()))
DIV=10**9+7
ans=0
if n%2==0:
  ans=a[0]
  for i in range(1,len(a)):
    ans+=ans^a[i]
    ans%=DIV
else:
  ans=a[0]^a[0]
  for i in range(1,len(a)):
    ans+=ans^(a[i]^a[i])
    ans%=DIV
print(ans)
              