output_description: Print the maximum number of happiness points that can be earned.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      X
attempt: """
  問題：
      高橋君は金色の硬貨が好きです。
      自分が持っている 500円硬貨 1枚につき 1000、
      5円硬貨 1枚につき 5の嬉しさ を得ます。
  
      高橋君は X 円を持っています。
      これを高橋君の嬉しさが最大になるように両替したとき、高橋君の嬉しさはいくらになりますか？
  
      (なお、利用できる硬貨は 500 円玉、100 円玉、50 円玉、10 円玉、5円玉、1 円玉の 6 種類とします。)
  """
  
  """
  Xは整数
  0 ≦ X ≦ 1,000,000,000
  """
  # def calc
  
  # 標準入力から X の値を取得する
  input_x = int(input())
  
  ret1 = input_x // 500  # 500円で割った商
  ret2 = ret1 * 1000  # 高橋君 500円の喜び
  ret3 = input_x - (ret1 * 500)  # X円から500円の枚数分を引いたお金
  ret4 = ret3 // 5  # （X円から500円の枚数分を引いたお金）÷ 5
  ret5 = ret4 * 5  # 高橋君 5円の喜び
  print(ret2 + ret5)
  
problem_description: Statement
  
  Takahashi loves gold coins. He gains 1000 _happiness points_ for each 500-yen
  coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is
  the currency of Japan.)
  
  Takahashi has X yen. If he exchanges his money so that he will gain the most
  happiness points, how many happiness points will he earn?
  
  (We assume that there are six kinds of coins available: 500-yen, 100-yen,
  50-yen, 10-yen, 5-yen, and 1-yen coins.)
samples: [{"input": "1024", "output": "2020\n    \n\nBy exchanging his money so that he gets two 500-yen coins and four 5-yen\ncoins, he gains 2020 happiness points, which is the maximum number of\nhappiness points that can be earned.\n\n* * *"}, {"input": "0", "output": "0\n    \n\nHe is penniless - or yenless.\n\n* * *"}, {"input": "1000000000", "output": "2000000000\n    \n\nHe is a billionaire - in yen."}]