output_description: Print the number of integers satisfying the condition, modulo 10^9+7.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: S = input()
  A = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
  a = 10**9 + 7
  for i in range(len(S)):
      B = A[:]
      if S[i] == "?":
          A[0] = (
              B[0] + B[9] + B[5] + B[1] + B[10] + B[6] + B[2] + B[11] + B[7] + B[3]
          ) % a
          A[1] = (
              B[4] + B[0] + B[9] + B[5] + B[1] + B[10] + B[6] + B[2] + B[11] + B[7]
          ) % a
          A[2] = (
              B[8] + B[4] + B[0] + B[9] + B[5] + B[1] + B[10] + B[6] + B[2] + B[11]
          ) % a
          A[3] = (
              B[12] + B[8] + B[4] + B[0] + B[9] + B[5] + B[1] + B[10] + B[6] + B[2]
          ) % a
          A[4] = (
              B[3] + B[12] + B[8] + B[4] + B[0] + B[9] + B[5] + B[1] + B[10] + B[6]
          ) % a
          A[5] = (
              B[7] + B[3] + B[12] + B[8] + B[4] + B[0] + B[9] + B[5] + B[1] + B[10]
          ) % a
          A[6] = (
              B[11] + B[7] + B[3] + B[12] + B[8] + B[4] + B[0] + B[9] + B[5] + B[1]
          ) % a
          A[7] = (
              B[2] + B[11] + B[7] + B[3] + B[12] + B[8] + B[4] + B[0] + B[9] + B[5]
          ) % a
          A[8] = (
              B[6] + B[2] + B[11] + B[7] + B[3] + B[12] + B[8] + B[4] + B[0] + B[9]
          ) % a
          A[9] = (
              B[10] + B[6] + B[2] + B[11] + B[7] + B[3] + B[12] + B[8] + B[4] + B[0]
          ) % a
          A[10] = (
              B[1] + B[10] + B[6] + B[2] + B[11] + B[7] + B[3] + B[12] + B[8] + B[4]
          ) % a
          A[11] = (
              B[5] + B[1] + B[10] + B[6] + B[2] + B[11] + B[7] + B[3] + B[12] + B[8]
          ) % a
          A[12] = (
              B[9] + B[5] + B[1] + B[10] + B[6] + B[2] + B[11] + B[7] + B[3] + B[12]
          ) % a
      else:
          s = int(S[i])
          for i in range(13):
              A[i] = B[(i * 4 + 9 * s) % 13]
  print(A[5])
  
problem_description: Statement
  
  Given is a string S. Each character in S is either a digit (`0`, ..., `9`) or
  `?`.
  
  Among the integers obtained by replacing each occurrence of `?` with a digit,
  how many have a remainder of 5 when divided by 13? An integer may begin with
  0.
  
  Since the answer can be enormous, print the count modulo 10^9+7.
samples: [{"input": "??2??5", "output": "768\n    \n\nFor example, 482305, 002865, and 972665 satisfy the condition.\n\n* * *"}, {"input": "?44", "output": "1\n    \n\nOnly 044 satisfies the condition.\n\n* * *"}, {"input": "7?4", "output": "0\n    \n\nWe may not be able to produce an integer satisfying the condition.\n\n* * *"}, {"input": "?6?42???8??2??06243????9??3???7258??5??7???????774????4?1??17???9?5?70???76???", "output": "153716888"}]