• [1614] A Magic Number

  • 时间限制: 1000 ms 内存限制: 65535 K
  • 问题描述
  • Radical loves magic things.Today,he wants to do some amazings about numbers.
    He has a number N , he wants to delete some digits (possibly none, but he is not allowed to delete all the digits)
    to form his "magic number" , a number that is divisible by 5. Note that, the resulting number may contain leading zeros.
    Now he wants to count the number of ways he can obtain magic number, modulo 1000000007 (1e9+7).
    Two ways are different, if the set of deleted positions in N differs.
    Look at the input part of the statement, N is given in a special form.
  • 输入
  • In the first line you're given a string a (1≤|a|≤1e5), containing digits only. In the second line you're given an integer k (1≤ k≤1e9).
    The number N is formed by concatenating k copies of a together. That is N=|a|·k.
  • 输出
  • Print a single integer — the required number of ways modulo 1000000007 (1e9+7).
  • 样例输入
  • 1256
    1
    555
    2
  • 样例输出
  • 4
    63
  • 提示
  • 来源
  • Radical@NBUT
  • 操作

显示春菜