### constant

MAX_N = 100000
MOD = 100000007

KEYS = [3, 5, 5, 5, 5, 5, 5, 5, 3, 5]

### main

dp5 = [0]
(1..5).each{|i| dp5[i] = 1 << (i - 1)}

for i in (6..MAX_N)
  d5 = 1
  for j in (1..5)
    d5 = (d5 + dp5[i - j]) % MOD
  end
  dp5[i] = d5
end

dp3 = [0]
(1..3).each{|i| dp3[i] = 1 << (i - 1)}

for i in (4..MAX_N)
  d3 = 1
  for j in (1..3)
    d3 = (d3 + dp3[i - j]) % MOD
  end
  dp3[i] = d3
end

loop do
  line = gets.strip
  break if line == '#'

  count = 1
  i = 0

  while ! line[i].nil?
    ch = line[i]
    len = 1

    while ch == line[i + len]
      len += 1
    end

    dp = (KEYS[ch.to_i] == 5) ? dp5[len] : dp3[len]
    count = (count * dp) % MOD

    i += len
  end

  puts count
end