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: def main():
      A, B, X = list(map(int, input().split()))
      if A >= X or B >= X:
          N = 0
      else:
          for d in range(len(str(X)), 0, -1):
              if d * B < X:
                  break
          if d > 0:
              d = min(X // A, pow(10, d))
              for N in range(d, 0, -1):
                  if afford(A, B, N, X):
                      break
              else:
                  N = 0
          else:
              N = 0
      print(N if N < 1e9 else int(1e9))
  
  
  def afford(a, b, n, x):
      c = a * n
      if c >= x:
          return False
      y = c + b * len(str(n))
      return y <= x
  
  
  if __name__ == "__main__":
      main()
  
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."}]