output_description: Print the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the
  condition.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: S = input()
  S = S[::-1]
  L = [0]
  i = 0
  for x in S:
      tmp = L[-1] + 10 ** i * int(x) % 2019
   #   print(tmp % 2019)
      L.append(tmp % 2019)
      i += 1
  L = sorted(L[1::])
  def counter(array):
      from collections import Counter
      return list(Counter(array).most_common())
  c = counter(L)
  from math import factorial
  def comb(n,r):
      if n == 1: return 0
      return  return n * (n - 1) // 
  ans = 0
  for x in c:
      if x[0] == 0: ans += x[1]
      ans += comb(x[1],2)
  #print(L,c)
  print(int(ans))
problem_description: Statement
  
  Given is a string S consisting of digits from `1` through `9`.
  
  Find the number of pairs of integers (i,j) (1 ≤ i ≤ j ≤ |S|) that satisfy the
  following condition:
  
  Condition: In base ten, the i-th through j-th characters of S form an integer
  that is a multiple of 2019.
samples: [{"input": "1817181712114", "output": "3\n    \n\nThree pairs - (1,5), (5,9), and (9,13) \\- satisfy the condition.\n\n* * *"}, {"input": "14282668646", "output": "2\n    \n\n* * *"}, {"input": "2119", "output": "0\n    \n\nNo pairs satisfy the condition."}]