program unhappy_hacking
  implicit none
  integer(8), parameter :: md = 1000000007_8
  integer :: n, m, i, j
  character(5000) :: s
  integer(8) :: dp(0:5000,0:5000) = 0_8, p = 1_8, t = 500000004_8
  read(*,*) n
  read(*,*) s
  s = trim(adjustl(s))
  m = len_trim(s)
  dp(0,0) = 1_8
  do i = 1, n
    dp(i,0) = mod(dp(i-1,0)+dp(i-1,1),md)
    do j = 1, i-1
      dp(i,j) = mod(2_8*dp(i-1,j-1)+dp(i-1,j+1),md)
    end do
    dp(i,i) = mod(2_8*dp(i-1,i-1),md)
  end do
  do i = 0, 15
    if (btest(m,i)) p = mod(t*p,md)
    t = mod(t*t,md)
  end do
  write(*,'(i0)') mod(dp(n,m)*p,md)
  stop
end program unhappy_hacking