output_description: Print the number of days before the next Sunday.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S
attempt: A, B, X = map(int, input().split())
  # 整数Nにたいして値段PはP=A*N + B*d(N), P<Xとなる最大のNを求める.ただしN<10**9以下となる
  # d(N)に対して探索してみる
  ketasu = 20
  while True:
      if ketasu == 0:  # なんにもかえない場合
          n = 0
          break
      Bdn = ketasu * B
      min_num = 1 * 10 ** (ketasu - 1)
      min_P = min_num * A + Bdn
      if min_P > X:
          ketasu -= 1
          continue
      else:  # Xで買える桁数
          n = (X - Bdn) // A
          if n == 10**ketasu:  # 10**ketasu
              n -= 1
          break
  if n > 10**9:
      print(10**9)
  else:
      print(n)
  
problem_description: Statement
  
  Given is a string S representing the day of the week today.
  
  S is `SUN`, `MON`, `TUE`, `WED`, `THU`, `FRI`, or `SAT`, for Sunday, Monday,
  Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively.
  
  After how many days is the next Sunday (tomorrow or later)?
samples: [{"input": "SAT", "output": "1\n    \n\nIt is Saturday today, and tomorrow will be Sunday.\n\n* * *"}, {"input": "SUN", "output": "7\n    \n\nIt is Sunday today, and seven days later, it will be Sunday again."}]