Problem:


Score : 200 points

Problem 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.)

Constraints

0 \leq X \leq 10^9

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the maximum number of happiness points that can be earned.

Sample Input 1

1024

Sample Output 1

2020

By exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.

Sample Input 2

0

Sample Output 2

0

He is penniless - or yenless.

Sample Input 3

1000000000

Sample Output 3

2000000000

He is a billionaire - in yen.



Sample input:
1024


Sample output:
2020

Submission status: Accepted

Solution code:
X = int(input())
a = 0
b = 0

if X < 500:
    if X % 5 == 0 :
        print(X)
    else:
        a = X // 5 * 5
        print(a)
elif X >= 500 :
    if X % 500 == 0 :
        print(X*2)
    else:
        a = X // 500 * 1000
        b = X % 500
        if b % 5 == 0 :
            print(a + b)
        else:
            b = b // 5 * 5
            print(a + b)

Submission status: Accepted

Solution code:
X = int(input())
happy = X  // 500 * 1000
happy = happy + ((X - 500 * (X // 500)) // 5) * 5
print(happy)

Submission status: Accepted

Solution code:

##get int
first_input = list(map(lambda x:int(x), input().split(" ")))
#second_input = list(map(lambda x:int(x), input().split(" ")))

##get string
#first_input = input().split(" ")

X = first_input[0]
num500 = X//500
num5 = (X-num500*500)//5

print(num500*1000+num5*5)

Submission status: Accepted

Solution code:
x = int(input())
a = int(x / 500)
x = x - a * 500
b = int(x / 5)
print((a*1000+b*5))

Submission status: Accepted

Solution code:
x = int(input())
 
print(x//500*1000 + (x%500)//5*5)

Submission status: Accepted

Solution code:
def s0():return input()
def s1():return input().split()
def s2(m):return [input() for x in range(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

x=n0()

a=x//500
b=(x-500*a)//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
x = int(input());

print(1000 * (x // 500) + (x - 500 * (x // 500)) // 5 * 5);

Submission status: Accepted

Solution code:
a = input()
a = int(a)

joy_500 = int(a / 500)
joy_5 = int((a%500)/5)

sum_joy = joy_500*1000 + joy_5*5


print(sum_joy)

Submission status: Accepted

Solution code:
X = int(input())
a = X//500
b = X -(a*500)
c = b//5
print((a*1000)+(c*5))

Submission status: Accepted

Solution code:
def main():
    X = int(input())

    num500 = X // 500

    num5 = (X - 500 * num500) // 5

    print(1000 * num500 + 5 * num5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
money = int(input())
total = 0

total += money // 500 * 1000
total += money % 500 // 5 * 5
print(total)

Submission status: Accepted

Solution code:
X = int(input())
 
div = int(X/500)
mod = int(X%500)
hap = 0
 
if div != 0:
  hap = div*1000
q = int(mod/5)
hap += q*5
 
print(hap)

Submission status: Accepted

Solution code:
N=int(input())
ans=N//500*1000
N-=(N//500)*500
ans+=N//5*5
print(ans)

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    five_hundreds, zan = divmod(x, 500)
    fives = zan // 5
    print(five_hundreds*1000+fives*5)

main()

Submission status: Accepted

Solution code:
X = int(input())

Obaek = int(X / 500)
X %= 500
Oen = int(X/5)

print (Obaek * 1000 + Oen * 5)

Submission status: Accepted

Solution code:
x=int(input())
print(str(int(x/500)*1000+int((x%500)/5)*5))

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    n500, x = divmod(x, 500)
    n5 = x // 5
    res = n500 * 1000 + n5 * 5
    print(res)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    n500 = x // 500
    x %= 500
    n5 = x // 5
    res = n500 * 1000 + n5 * 5
    print(res)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    n500 = x // 500
    x = x - n500 * 500
    n5 = x // 5
    res = n500 * 1000 + n5 * 5
    print(res)



if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
input_int=int(input())
five_h_y=0
five_y=0

five_h_y=int(input_int/500)
input_int=input_int-500*five_h_y

five_y=int(input_int/5)

print(five_h_y*1000+five_y*5)

Submission status: Accepted

Solution code:
str = int(input())
print(int(str/500)*1000 + int((str%500)/5)*5)

Submission status: Accepted

Solution code:
from collections import deque
s = int(input())

big = int(s/500)
s = s- big*500

print(big*1000 +int(s/5)*5)

Submission status: Accepted

Solution code:
n = int(input())
five_hundred_happiness = int(n/500)
five_happiness = int((n-500*five_hundred_happiness)/5)
happiness = five_hundred_happiness * 1000 + five_happiness * 5
print(happiness)

Submission status: Accepted

Solution code:
x = int(input())

# xが5未満の時
if 0<=x and x< 5:
    print(0)
# xが500未満の場合   
if 5<= x and x<500:
    print((x//5)*5)
# xが500以上の場合
if x >= 500:
   f = x//500
   a = x % 500
   if 5<= a:
       b = a//5
       print(f*1000 + b*5)
   else:
        print(f*1000)

Submission status: Accepted

Solution code:
X = int(input())
answer = (X // 500) * 1000
new_X = X % 500
answer += (new_X // 5) * 5
print(answer)

Submission status: Accepted

Solution code:
x = int(input())
p = 0
if x / 500 > 0:
    p += 1000 * int(x / 500)
    x -= int(x / 500) * 500
if x / 5 > 0:
    p += 5 * int(x / 5)
print(p)

Submission status: Accepted

Solution code:
x = int(input())
a, b = divmod(x, 500)
b //= 5
print(1000 * a + 5 * b)

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

x = ni()
ans = 0
ans += (x // 500) * 1000
x -=(x // 500) * 500
ans += (x // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
X=int(input())
ans=0
ans+=int(X/500)*1000
X=X-int(X/500)*500
ans+=int(X/5)*5
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

X = int(input())

a = X // 500
X = X - 500 * a
b = X // 5
print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
x = int(input())
a = x // 500
b = (x % 500) // 5
print(1000*a + 5*b)

Submission status: Accepted

Solution code:
a=int(input())
b=(a//500)*1000
c=((a%500)//5)*5
print(b+c)

Submission status: Accepted

Solution code:
x=int(input())
ans=0
ans += 1000*(x//500)
x = x%500
ans += 5*(x//5)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500
b = X % 500
c = b // 5
print(a * 1000 + c * 5)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
# coding: utf-8
import sys
sys.setrecursionlimit(10000000)

#const
dxdy=((1,0),(0,1))
# my functions here!
def pin(type=int):
    return map(type,input().rstrip().split())

def resolve():
    t,=pin()
    print(1000*(t//500)+5*((t%500)//5))
"""         
#printデバッグ消した？
#前の問題の結果見てないのに次の問題に行くの？
"""
"""
お前カッコ閉じ,るの忘れてるだろ
"""
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """1024"""
        output = """2020"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """0"""
        output = """0"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """1000000000"""
        output = """2000000000"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
cash = int(input().rstrip())
point = cash // 500 * 1000
cash %= 500
point += cash // 5 * 5
print(point)

Submission status: Accepted

Solution code:
cash = int(input().rstrip())
                             
#500円
point = cash // 500 * 1000
cash %= 500

#5円
point += cash // 5 * 5
cash %= 5

print(point)

Submission status: Accepted

Solution code:
x = int(input())
ans = (x // 500) * 1000 + (x % 500) // 5 * 5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
num_500 = x // 500
x = x - num_500 * 500
num_5 = x // 5
print(num_500 * 1000 + num_5 * 5)

Submission status: Accepted

Solution code:
x=int(input())
print(x//500*1000 + (x%500)//5*5)

Submission status: Accepted

Solution code:
x = int(input())
k = x//500
kk = (x-500*k)//5
print(k*1000+kk*5)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    rm = X % 500
    print(X // 500 * 1000 + rm // 5 * 5)
    return


main()

Submission status: Accepted

Solution code:
def solve_uresisa(cash,uresisalist):
    coins = uresisalist.keys()
    uresisa = 0
    for coin in coins:
        uresisa += cash//coin * uresisalist[coin]
        cash = cash % coin
    return uresisa

uresisalist = {500:1000,5:5}
cash = int(input())
print(solve_uresisa(cash,uresisalist))

Submission status: Accepted

Solution code:
x = int(input())
HP = 0
FUCK = False

if x < 5:
  print(0)
  FUCK = True

while x >= 500:
  x -= 500
  HP += 1000

while x >= 5:
  x -= 5
  HP += 5

if not FUCK:
    print(HP)

Submission status: Accepted

Solution code:
a = int(input())
q_1, mod = divmod(a, 500)
q_2 = mod // 5
print(q_1 * 1000 + q_2 * 5)

Submission status: Accepted

Solution code:
S = int(input())
answer = 0
answer += S // 500 * 1000
answer += (S % 500) // 5 * 5
print(answer)

Submission status: Accepted

Solution code:
X = int(input())

num_500 = X//500
X = X - num_500 * 500
num_5 = X//5

print(1000*num_500 + 5*num_5)

Submission status: Accepted

Solution code:
X = int(input())

Fivehundred_yen = X // 500
Balance = X % 500

five_yen = Balance // 5

total_happy = Fivehundred_yen * 1000 + five_yen * 5
print(total_happy)

Submission status: Accepted

Solution code:
x=int(input())
  
a=x//500
x=x-a*500

b=x//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

c500 = X //500

X -= c500 * 500

c5 = X // 5


print(c500*1000+c5*5)

Submission status: Accepted

Solution code:
X=int(input())

print((X//500*1000)+((X%500)//5)*5)

Submission status: Accepted

Solution code:
money = int(input())

glad = 0

coins = [500,5]

while money >= 500:
    money -= 500
    glad += 1000

while money >= 5:
    money -= 5
    glad += 5

print(glad)

Submission status: Accepted

Solution code:
x = int(input())
x_500 = x // 500
x_500mod = x % 500
x_5 = x_500mod // 5
print(x_500 * 1000 + x_5 * 5)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0

ans += (x // 500) * 1000
x -= (x // 500) * 500
ans += (x // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

c500 = X // 500
X %= 500
c5 = X // 5

print(c500*1000 + c5*5)

Submission status: Accepted

Solution code:
x = int(input())
q, mod = divmod(x, 500)
print(q*1000 + 5*(mod//5))

Submission status: Accepted

Solution code:
x = int(input())
out = (x // 500) * 1000 + ((x%500)//5) * 5
print(out)

Submission status: Accepted

Solution code:
X = int(input())
count=0

while X>0:
	if X>=500:
		X-=500
		count+=1000
	elif X>=5:
		X-=5
		count+=5
	else:
		break
print(count)

Submission status: Accepted

Solution code:
X=int(input())
print(X//500*1000+(X-X//500*500)//5*5)

Submission status: Accepted

Solution code:
X= int(input())

print((X//500)*1000 + (X%500)//5*5)

Submission status: Accepted

Solution code:
x = int(input())
print((x//500 )*1000 + ((x%500)//5)*5)

Submission status: Accepted

Solution code:
x=int(input())
a,b=divmod(x,500)
print(a*1000+(b//5)*5)

Submission status: Accepted

Solution code:
num=int(input())
a=int(num/500)
b=int((num%500)/5)
print(1000*a+5*b)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0

ans += (X//500) * 1000
X = X % 500

ans += (X//5) * 5

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/python3

x = int(input())

print((x // 500) * 1000 + ((x % 500) // 5) * 5)

Submission status: Accepted

Solution code:
import sys

x=int(sys.stdin.readline())
ans=x//500*1000
ans+=((x%500)//5)*5

print(ans)

Submission status: Accepted

Solution code:
def int_input():
    return int(input())
  
yens = int_input()

if yens >= 500:
  yens_500 = yens // 500
  yens_5 = (yens % 500) // 5
  happiness_pts = (yens_500 * 1000) + (yens_5 * 5)
  print(happiness_pts)
else:
  print((yens//5) * 5)

Submission status: Accepted

Solution code:
yen = int(input())
count = 0

while yen - 500 >= 0:
    yen -= 500
    count += 1000

while yen - 5 >= 0:
    yen -= 5
    count += 5

print(count)

Submission status: Accepted

Solution code:
X = int(input())
ans = 1000*(X//500)+5*(X%500//5)
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
c = 0
while X>=500:
  c = c + 1000
  X = X - 500
while X>=5:
  c = c + 5
  X = X - 5
print(c)

Submission status: Accepted

Solution code:
a = int(input())

s = a // 500
a = a - (s * 500)

k = a // 5

print((s * 1000) +( k * 5))

Submission status: Accepted

Solution code:
x = int(input())
ans = 0

c500 = x // 500
ans += c500 * 1000
x -= c500 * 500
c50 = x // 5
ans += c50 * 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

A = int(X/500)
U = int(A*1000 + (X - A*500)//5*5)

print(U)

Submission status: Accepted

Solution code:
x = int(input())
five_hundred_yen = x//500
five_yen = (x - 500*five_hundred_yen)//5
happiness = five_hundred_yen*1000 + five_yen*5
print(happiness)

Submission status: Accepted

Solution code:
X=int(input())
ans=(X-X%500)*2
X=X%500
ans=ans+(X-X%5)
print(ans)

Submission status: Accepted

Solution code:
X=int(input())
num_500=X//500
num_5=(X%500)//5
print(num_500*1000+num_5*5)

Submission status: Accepted

Solution code:
n=int(input())
ans=(n//500)*1000
n-=(n//500)*500
ans+=(n//5)*5
print(ans)

Submission status: Accepted

Solution code:
def five_h(x):
  count = 0
  count += int(x / 500) * 1000
  x -= int(x / 500) * 500
  count += int(x / 5) * 5
  return count

def main():
  x = int(input())
  count = 0
  
  if(x <= 10 ** 9 and x >= 0):
    if(isinstance(x, int)):
      count += five_h(x)
      print(count)

if __name__ == "__main__":
  main()

Submission status: Accepted

Solution code:
import math

line = input()
money = int(line)
happy = 0

calc_500 = math.floor(money / 500)

if calc_500 >= 1:
  happy += calc_500 * 1000
  money -= calc_500 * 500
  calc_5 = math.floor(money / 5)
  
  if calc_5 >= 1:
      happy += calc_5 * 5
      print(str(happy))
  else:
      print(str(happy))
else:
    calc_5 = math.floor(money / 5)
    if calc_5 >= 1:
      happy += calc_5 * 5
      print(str(happy))
    else:
      print(str(happy))

Submission status: Accepted

Solution code:
# B - Golden Coins
# https://atcoder.jp/contests/abc160/tasks/abc160_b

X = int(input())

count_500, X = divmod(X, 500)
count_5 = X // 5

print(count_500 * 1000 + count_5 * 5)

Submission status: Accepted

Solution code:
C = int(input())

b = 1000*(C//500)
mod = C % 500
s = 5*(mod//5)
print(b+s)

Submission status: Accepted

Solution code:
S = open(0).read().strip('\n')
q = int(S) // 500
mod = int(S) % 500 //5
print(q*1000+mod*5)

Submission status: Accepted

Solution code:
en = int(input())

a = int(en/500)
b = int(en%500/5)

print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

print(X//500*1000 + (X%500)//5*5)

Submission status: Accepted

Solution code:
x=int(input())
coin500 = x//500
x%=500
coin5 = x//5
print(coin500*1000+coin5*5)

Submission status: Accepted

Solution code:
coin = int(input())
ureshi = coin // 500 * 1000
ureshi += coin % 500 // 5 * 5
print(ureshi)

Submission status: Accepted

Solution code:
X = int(input())
if X == 0:
    print("0")
else:
    a = 0
    b = 0
    c = 0
    a = X // 500
    b = X - 500 * a
    c = b // 5
    print((a * 1000) + (c * 5))

Submission status: Accepted

Solution code:
X=int(input())
A=(X//500)
B=((X%500)//5)
print((1000*A)+(5*B))

Submission status: Accepted

Solution code:
x = int(input())

happy = int(x / 500) * 1000
x = x % 500
happy = happy + int(x / 5) * 5
print(happy)

Submission status: Accepted

Solution code:
x = int(input())

ans = x//500 *1000 + x%500//5*5
print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# coding: utf-8
# import sys
# import pprint
# import numpy as np
# import code


if __debug__:
    debug = lambda *x: None
else:
    import logging
    logger = logging.getLogger()
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    logger.addHandler(ch)
    debug = logger.debug

x = int(input())

debug(x)

c500 = int(x / 500)
xx = x % 500
c5 = int(xx / 5)

u = c500 * 1000 + c5 * 5

print(u)

Submission status: Accepted

Solution code:
X = int(input())
happi = (X // 500) * 1000 + (X % 500 // 5) * 5
print(happi)

Submission status: Accepted

Solution code:
s=int(input())
temp=0
temp+=(s//500)*1000
s=s%500
temp+=(s//5)*5
print(temp)

Submission status: Accepted

Solution code:
x = int(input())
five_hun = 0
five = 0
score = 0

five_hun+=x//500
five = (x - five_hun*500)//5
print(five_hun*1000+five*5)

Submission status: Accepted

Solution code:
sum1 = 0
Coin500 = 500
Coin100 = 100
Coin50 = 50
Coin10 = 10
Coin5 = 5
Coin1 = 1

x = int(input())

while True:
    if x - Coin500 >= 0:
        sum1 = sum1 + 1000
        x = x - Coin500
    else:
        break

while True:
    if x - Coin5 >= 0:
        sum1 = sum1 + 5
        x = x - Coin5
    else:
        break

print(sum1)

Submission status: Accepted

Solution code:
n = int(input())

point500 = (n // 500) * 1000
remain500 = n % 500
point5 = (remain500 // 5) * 5
print(point5 + point500)

Submission status: Accepted

Solution code:
x=int(input())

a=x//500

b=(x-a*500)//5

print(1000*a+5*b)

Submission status: Accepted

Solution code:
s=int(input())
a= s//500
b=(s%500)//5
yasashisa=a*1000+b*5
print(yasashisa)

Submission status: Accepted

Solution code:
s = int(input())
count1=-1
count2=-1
while s>=0:
 s=s-500
 count1=count1 +1
s=s+500
if s==0:
  yasashisa=count1*1000
  print(yasashisa)
else:
   while s >=0:
     s=s-5
     count2=count2 +1
   yasashisa=count1*1000+count2* 5
   print(yasashisa)

Submission status: Accepted

Solution code:
x = int(input())
x500 = x // 500
x5 = (x % 500) // 5
print(1000 * x500 + 5 * x5)

Submission status: Accepted

Solution code:
x = int(input())

five_hundered_coin = x // 500
five_coin = (x - five_hundered_coin * 500) // 5

happiness = five_hundered_coin * 1000 + five_coin * 5
print(happiness)

Submission status: Accepted

Solution code:
X = int(input())
y = X // 500
X = X % 500
y = 1000 * y + (X // 5) * 5
print(y)

Submission status: Accepted

Solution code:
X=int(input()) #1200
a=X//500 #2
b=(X-500*a)//5  #
print(1000*a+5*b)

Submission status: Accepted

Solution code:
import math
a=int(input())
n = math.floor(a/500)
m = math.floor((a - n * 500)/5)
total_price= n * 1000 + m*5
print(total_price)

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500
b = (X - 500 * a) // 5
print(1000 * a + 5 * b)

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
X = X % 500
b = X // 5

print(1000 * a + 5 * b)

Submission status: Accepted

Solution code:
X = int(input())

A = X//500  #500en
nokori = X - A*500

B = nokori //5   #5en

ureshisa = 1000*A + 5*B

print(ureshisa)

Submission status: Accepted

Solution code:
yen_str = input()
yen = int(yen_str)

a = yen // 500
b = yen % 500
c = b // 5

print(1000*a+5*c)

Submission status: Accepted

Solution code:
n = int(input())
x=n//500
y=(n%500)//5
print(x*1000+y*5)

Submission status: Accepted

Solution code:
n = int(input())
m = n%500
k = m%5
print(int((n - m)*1000/ 500 + (m - k)*5//5))

Submission status: Accepted

Solution code:
n =int(input())
ex = n
h500 = int(n / 500)
ex = ex - h500 * 500
h5 = int(ex / 5)
ex = ex - h5 *5
print(h500 * 1000 + h5 * 5 )

Submission status: Accepted

Solution code:
a = int(input())
b = a // 500
res1 = b * 1000

c = a - b * 500
d = c // 5
res2 = d * 5

print("{}".format(res1+res2))

Submission status: Accepted

Solution code:
x = int(input())
gold = int(x/500)
silver = int((x - 500*gold)/5)
print(gold*1000 + silver*5)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    a = int(input())
    tmp = 0
    result = int(0)
    while a >= 5:
        coin500 = int(a / 500)
        a %= 500
        coin5 = int(a / 5)
        a %= 5
        result += (coin5 * 5) + (coin500 * 1000)
    print(result)

Submission status: Accepted

Solution code:
n=int(input())
ans=(n//500)*1000
n=n%500
ans+=(n//5)*5
print(str(ans))

Submission status: Accepted

Solution code:
n=int(input())
ans=0
while(n>4):
  ans+=(n//500)*500
  ans+=(n//5)*5
  n-=ans
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

print((x // 500) * 1000 + ((x % 500) // 5) * 5)

Submission status: Accepted

Solution code:
n = int(input())

print(int((n/500))*1000 + int((n%500)/5)*5)

Submission status: Accepted

Solution code:
X = int(input())
ans = (X // 500) * 1000
X = X % 500
ans += X // 5 * 5

print(ans)

Submission status: Accepted

Solution code:


x = int(input())

more = int(x/500)
left = x%500
less = int(left/5)
# print(more, less)
print(more*1000 + less*5)

Submission status: Accepted

Solution code:
X = int(input())
sum = 0

while X >= 500:
    X -= 500
    sum += 1000

while X >= 5:
    X -= 5
    sum += 5

print(sum)

Submission status: Accepted

Solution code:
x= int(input())
print((x//500)*1000 + (x % 500)//5*5)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

def main():
    X = int(input())
    X -= X%5
    tmp = X//500
    print(tmp * 500 + X)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())
a,b = X//500,(X%500)//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
x = int(input())
a = x//500
b = (x-500*a)//5
print(a*1000 + b*5)

Submission status: Accepted

Solution code:
s = int(input())
sum = 0
if s == 0:
    print(0)
else:
    sum += (s // 500) * 1000
    s -= (s//500) * 500
    sum += (s // 5) * 5
    print(sum)

Submission status: Accepted

Solution code:
x = int(input())
q1, mod1 = divmod(x, 500)
q2, mod2 = divmod(mod1, 5)
print(1000*q1 + 5*q2)

Submission status: Accepted

Solution code:
X = int(input())

if(0 <= X and X <500):
    q,mod = divmod(X,5)
    Q1 = 5*q
    print(Q1)
if(500 <= X):
    q,mod = divmod(X,500)
    if(5 <= mod):
        q1,mod1 = divmod(mod,5)
    else:
        q1 = 0
    Q = 1000*q + 5*q1
    print(Q)

Submission status: Accepted

Solution code:
import math
X = int(input())

c1 = math.floor(X/500)
res = X%500
c2 = math.floor(res/5)

ans = c1*1000 + c2*5
print(str(ans))

Submission status: Accepted

Solution code:
A=int(input())
happy=0
happy+=(A//500)*1000
A=A%500
happy+=(A//5)*5
print(happy)

Submission status: Accepted

Solution code:

def quick_sort(arr):
    left = []
    right = []
    if len(arr) <= 1:
        return arr

    # データの状態に左右されないためにrandom.choice()を用いることもある。
    # ref = random.choice(arr)
    ref = arr[0]
    ref_count = 0

    for ele in arr:
        if ele < ref:
            left.append(ele)
        elif ele > ref:
            right.append(ele)
        else:
            ref_count += 1
    left = quick_sort(left)
    right = quick_sort(right)
    return left + [ref] * ref_count + right


if __name__ == "__main__":
    x = int(input())
    points = 0
    tmp = int(x/500)
    points += tmp * 1000
    x -= tmp*500

    tmp = int(x/5)
    points += tmp*5

    print(points)
    





      
# for i in range(10):
#     print(i)
#     if i%5==4:
#         break

Submission status: Accepted

Solution code:
num_origin = int(input())
gohyoku = int(num_origin/500)
num_zan = num_origin - gohyoku*500
go = int(num_zan/5)
 
num = go*5 + gohyoku*1000
 
print(num)

Submission status: Accepted

Solution code:
n = int(input())
ans = n // 500 * 1000
n %= 500
ans += n // 5 * 5
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
b=int(a/500)
c=int((a%500)/5)
ans=b*1000+c*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
 
print(int(X/500)*1000 + int((X%500)/5)*5)

Submission status: Accepted

Solution code:
X = input()
X = int(X)
if 0 <= X and X <= 10**9:
  a = X // 500
  b = (X % 500) // 5
  print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
x=int(input())

cnt_500 = int(x/500)
cnt_5 = int((x-cnt_500*500)/5)

ans = cnt_500*1000+cnt_5*5
print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = int(a/500)*1000
c = a%500
d = int(c/5)*5
print(b+d)

Submission status: Accepted

Solution code:
num = int(input().strip())
ans = 0
ans += (num//500)*1000
num = num%500
ans += (num//5)*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
happy = x // 500 * 1000 + (x % 500) // 5 * 5
print(happy)

Submission status: Accepted

Solution code:
X=int(input())
A=X//500
B=(X-500*A)//5

T=round(A)
F=round(B)
glad=1000*T+5*F

print(glad)

Submission status: Accepted

Solution code:
X = int(input())

yen500 = X // 500
nokori = X - yen500 * 500
yen5 = nokori // 5

print(yen500 * 1000 + yen5 * 5)

Submission status: Accepted

Solution code:
if __name__=='__main__':
    S = int(input())
    n1 = int(S/500)
    n2 = int((S%500)/5)
    print(n1*1000+n2*5)

Submission status: Accepted

Solution code:
x = int(input())
fh = x // 500
f = (x % 500) // 5
print(fh * 1000 + f * 5)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0

ans = ans + x // 500 * 1000
a = x % 500
ans=ans+a//5*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
c_500 = x // 500
c_5 = (x - c_500*500) // 5

print(c_500*1000 + c_5*5)

Submission status: Accepted

Solution code:
x=int(input())
a=x//500
b=x%500
x-=a*500
c=x//5
print(a*1000+c*5)

Submission status: Accepted

Solution code:
X = int(input())
ans = X//500*1000
ans += (X%500)//5*5
print(ans)

Submission status: Accepted

Solution code:
def happiness(cash):
    count_500 = cash // 500
    count_5 = (cash % 500) //5
    return 1000 * count_500 + 5 * count_5

X = int(input())
print(happiness(X))

Submission status: Accepted

Solution code:
n = int(input())
a = n//500
b = (n-500*a)//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

L = (X // 500)

S = (X - 500 * L) // 5

print(L*1000+S*5)

Submission status: Accepted

Solution code:
a=int(input())
b=a//500
c=a%500
d=c//5
ans=b*1000+d*5
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
l=[500,100,50,10,5,1]
v=n//500
u=n-v*500
v1=u//5
#print(v,v1)
print(v*1000+v1*5)

Submission status: Accepted

Solution code:
price = int(input())
num500 = price // 500
price = price % 500
num5 = price // 5
print(num500 * 1000 + num5 * 5)

Submission status: Accepted

Solution code:
X=int(input())
a=X//500
X%=500
b=X//5
print(1000*a+5*b)

Submission status: Accepted

Solution code:
x = int(input())

print((x//500)*1000+((x-(x//500)*500)//5)*5)

Submission status: Accepted

Solution code:
X=int(input())
ans = 0
ans += 1000*(X//500)
ans += 5*((X%500)//5)
 
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
if x >= 500:
    ans += x // 500 * 1000
    x -= x // 500 * 500
if x >= 5:
    ans += x // 5 * 5

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
k=n//500
ans=0
ans+= k*1000

y=n%500
ans+= (y//5)*5
print(ans)

Submission status: Accepted

Solution code:
x=int(input())
a = int(x/500)
b = x%500
c = int(b/5)
print(a*1000+c*5)

Submission status: Accepted

Solution code:
h = 0
x = int(input())
h = ((x//500)*1000)+(((x%500)//5)*5)
print(h)

Submission status: Accepted

Solution code:
X = int(input())
ans = X // 500 * 1000
X %= 500
ans += X // 5 * 5
print(ans)

Submission status: Accepted

Solution code:
sum = int(input())

q = sum // 500
mod = sum % 500

p = mod//5

sum = q*1000 + (p*5)

print(sum)

Submission status: Accepted

Solution code:
X=int(input())
ans=X//500*1000
X-=X//500*500
ans+=X//5*5
print(ans)

Submission status: Accepted

Solution code:
S = int(input())

score = 0

score += (S//500)*1000

S = S%500

score += (S//5)*5

print(score)

Submission status: Accepted

Solution code:
x = int(input())
 
if x%500 == 0:
  print(x*2)
else:
  X = (x//500)
  ans = (X*1000) + ((x%500)//5)*5
  print(ans)

Submission status: Accepted

Solution code:
X=int(input())
print((X//500)*1000+5*((X%500)//5))

Submission status: Accepted

Solution code:
X = int(input())

ureshisa = 1000*(X//500)
X %= 500
ureshisa += 5*(X//5)

print(ureshisa)

Submission status: Accepted

Solution code:
X = int(input())
a = X//500
b = (X-a*500)//5
print(int(1000*a+5*b))

Submission status: Accepted

Solution code:
x = int(input())

ans = x//500 * 1000
ans = ans + (x%500//5) * 5
 

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

num_500, mod = divmod(X, 500)
num_5 = mod // 5

print(1000 * num_500 + 5 * num_5)

Submission status: Accepted

Solution code:
X = int(input())
ans = 0

ans += X // 500 * 1000
X %= 500

ans += X // 5 * 5

print(ans)

Submission status: Accepted

Solution code:
import sys

x = int(input())
happiness = 0
happiness += x//500 * 1000
x = x%500
happiness += x//5 * 5
print(happiness)

Submission status: Accepted

Solution code:
N = int(input())

ans = 0
ans += int(N/500) * 1000
ans += int((N%500)/5) * 5
print(ans)

Submission status: Accepted

Solution code:
input_i = int(input())
l_happy = input_i//500
s_happy = (input_i - (l_happy*500))//5

result = l_happy*1000+s_happy*5
print(result)

Submission status: Accepted

Solution code:
n = int(input())
a = n//500
b = (n%500)//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
x = int(input())

a = x//500
b = (x - 500*a)//5
ans = 1000*a + 5*b

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
ans = (x // 500) * 1000 + ((x % 500) // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

answer = (X // 500) * 1000 + ((X % 500) // 5) *5
print(answer)

Submission status: Accepted

Solution code:
def main(money):
    happiness = 0

    happiness += (money // 500) * 1000
    money = money % 500

    happiness += (money // 5) * 5

    print(happiness)


main(int(input()))

Submission status: Accepted

Solution code:
import math
X = int(input())

A = X // 500   #Xを500で割った商
a = X % 500    #Xを500で割った剰余

B = a // 5

print((A * 1000) + B * 5)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0

ans += x // 500 * 1000
x %= 500
ans += x // 5 * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
a = int(X / 500)
b = int((X- 500 * a) / 5)
ans = 1000 * a + 5 * b
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
 
cnt = X//500
new_X = X - cnt * 500
ncnt = new_X // 5
print(cnt*1000 + ncnt*5)