class Integer
  def pow(y, m)
    return 1 if y == 0
    res = self.pow(y/2, m)
    res * res % m * (y.odd? ? self : 1) % m
  end
end

L = gets.chomp
# L = ?1 * 100001
MOD = 10**9+7

bases = [0] * 100002
bases[0] = 1
(1...bases.size).each{|i|
  bases[i] = (bases[i - 1] * 3 - 1) % MOD
}

cnt = 0
ans = 0
L.chars.each_with_index{|c, i|
  if c != ?0
    ans += bases[L.size - i - 1] * 2.pow(cnt, MOD)
    cnt += 1
  end
}
p (ans*2+1) % MOD