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:
  
      
      
      K
      D
attempt: import sys
  
  fin = sys.stdin.readline
  
  
  MOD = 10**9 + 7
  K = [int(elem) for elem in fin()[:-1]]
  D = int(fin())
  
  dp = [[0] * 2 for _ in range(D)]
  dp[0][1] = 1
  
  for bound in K:
      next_dp = [[0] * 2 for _ in range(D)]
      for num in range(10):
          for d in range(D):
              next_reminder = (num + d) % D
              if num < bound:
                  next_dp[next_reminder][0] += dp[d][0] + dp[d][1]
              elif num == bound:
                  next_dp[next_reminder][0] += dp[d][0]
                  next_dp[next_reminder][1] += dp[d][1]
              else:
                  next_dp[next_reminder][0] += dp[d][0]
              next_dp[next_reminder][0] %= MOD
              next_dp[next_reminder][1] %= MOD
      # import pdb; pdb.set_trace()
      dp = next_dp
  
  res = dp[0][0] + dp[0][1] - 1
  print(res) if res >= 0 else print(res + MOD)
  
problem_description: Statement
  
  Find the number of integers between 1 and K (inclusive) satisfying the
  following condition, modulo 10^9 + 7:
  
    * The sum of the digits in base ten is a multiple of D.
samples: [{"input": "30\n    4", "output": "6\n    \n\nThose six integers are: 4, 8, 13, 17, 22 and 26.\n\n* * *"}, {"input": "1000000009\n    1", "output": "2\n    \n\nBe sure to print the number modulo 10^9 + 7.\n\n* * *"}, {"input": "98765432109876543210\n    58", "output": "635270834"}]