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())


X1 = X // 500
X2 = X % 500
X3 = X2 // 5

cnt = X1 * 1000 + X3*5

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
money = int(input())
b = money // 500
c = (money - b*500) // 5
ans = b*1000 + c*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
s = 0
p = 0
while X >= 500:
    X = X - 500
    s = s + 1
while X >= 5:
    X = X - 5
    p = p + 1
print(1000*s+5*p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
n500 = 0
n5 = 0
n500 = x // 500
x = x - n500*500
n5 = x // 5
x = x - n5*5

print(1000*n500 + 5*n5)

Submission status: Accepted

Solution code:
def nyu():
    X= int(input())
    return X


def check(X ):
    sum = 0

    x = X

    sum = int(x / 500) * 1000 
    x = x % 500
 #   print("sum ",sum,"X",x)
    sum += int(x/5)*5
    print(sum)


            
X = nyu()
check(X)
#print(S)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
counta = 0
countb = 0
while X>=500:
  counta +=1
  X -= 500
  
while X>=5:
  countb +=1
  X -= 5
print(1000*counta+5*countb)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

coin_500 = x // 500
coin_5 = (x % 500) // 5

print(coin_500*1000 + coin_5*5)

Submission status: Accepted

Solution code:
a = int(input())

i = 0
while a >= 500:
    i = i+1
    a = a-500

j = 0
while a >= 5:
    j = j+1
    a = a-5

print(1000*i+5*j)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

p=0
while x>=500:
        x-=500
        p+=1000

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

print(p)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


if __name__ == "__main__":
    _in = [_.rstrip() for _ in stdin.readlines()]
    X = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    cnt = (X//500)*1000+((X%500)//5)*5
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(cnt)

Submission status: Accepted

Solution code:
x =int(input())
total =0
count =0
for i in range(x):
    if 500*i ==x:
        count =i*1000
        break
    elif 500*i > x:
        total =abs(500*(i-1) -x)
        count =(i-1) *1000
        # print(count)
        break
if total ==0:
    print(count)
else:
    for i in range(x):
        if 5*i ==total:
            count +=i*5
            break
        elif 5*i >total:
            count +=(i-1)*5
            break
    print(count)

Submission status: Accepted

Solution code:
x =int(input())
total =0
count =0
for i in range(x):
    if 500*i ==x:
        count =i*1000
        break
    elif 500*i > x:
        total =abs(500*(i-1) -x)
        count =(i-1) *1000
        # print(count)
        break
if total ==0:
    print(count)
else:
    for i in range(x):
        if 5*i ==total:
            print("aa")
            count +=i*5
        elif 5*i >total:
            count +=(i-1)*5
            # print(count)
            # total =abs(5*(i-1) -total)
            break
    print(count)

Submission status: Accepted

Solution code:
X = int(input())

count_500 = 0
count_5 = 0
if X >= 500:
    count_500 += int(X/500)
    X = X%500
    if X >= 5:
        count_5 += int(X/5)
        X = X%5
else:
    count_5 += int(X/5)
    X = X%5

print(count_500*1000 + count_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

fh=math.floor(X/500)
rest=X-(fh*500)
f=math.floor(rest/5)
fun=fh*1000+f*5

print(fun)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
 
max500 = money // 500
rem500 = money % 500
 
max5 = rem500 // 5
 
happiness = max500 * 1000 + max5 * 5
 
print(happiness)

Submission status: Accepted

Solution code:
N = int(input())

A = N//500
B = (N-A*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())
happy=0
X_hap500=X//500
X=X-X_hap500*500
X_hap5=X//5
happy=X_hap500*1000+X_hap5*5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# input the number
x = int(input())

# show how many times 500¥ and 5¥ can divide
div_500 = x // 500
div_5 = (x - div_500 * 500) // 5

# pleasure of Mr TAKAHASHI
pleasure = 1000 * div_500 + 5 * div_5
print(pleasure)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

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:
X = int(input())
print(X//500*1000+(X-X//500*500)//5*5)

Submission status: Accepted

Solution code:
def happinessCalculator(money):
	points = 0
	if money == 0:
		return points
	while money >= 500:
		money -= 500
		points += 1000
	while money >= 5:
		money -= 5
		points += 5
	return points

print(happinessCalculator(int(input())))

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:
# coding: utf-8
# Your code here!

X = int(input())

n_500, n_5 = 0, 0
rem = 0

n_500 = X // 500
rem = X % 500
n_5 = rem // 5
print(n_500 * 1000 + n_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
print(x//500*1000+((x-500*(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())
ans = 0
ans+=x//500*1000
x%=500
ans+=x//5*5
print(ans)

Submission status: Accepted

Solution code:
money = int(input())
five_hun = money // 500
remainder = money % 500
five = remainder // 5
remainder = remainder % 5
print(five_hun * 1000 + five * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

happy_500 = 0
if X>=500:
    happy_500 = X//500
X = X-happy_500*500
happy_5 = 0
if X>=5:
    happy_5 = X//5
print(happy_500*1000+happy_5*5)

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500
b = (X % 500) // 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:
N = int(input())

A = N // 500
B = (N % 500) // 5

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	X = int(input())
	ans = 0
	ans += int(X // 500) * 1000
	ans += int((X % 500) // 5) * 5
	print(ans)
	
if __name__ == '__main__':
	main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
happy = 0
d_500, m_500 = divmod(X, 500)
d_5, m_5 = divmod(m_500, 5)
print(d_500 * 1000 + d_5 * 5)

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())

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

Submission status: Accepted

Solution code:
X=int(input())
Y=X//500
Z=(X-Y*500)//5

print(int(Y*1000+Z*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:

url = "https://atcoder.jp//contests/abc160/tasks/abc160_b"

def main():
    N = int(input())
    n, m = divmod(N, 500)
    # print(n, m)
    print((1000 * (N // 500)) + (5 * ((N % 500) // 5)))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
X=int(input())
f_hand=math.floor(X/500)
amari=X%500
go=math.floor(amari/5)
happy=f_hand*1000+go*5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())


hap = x // 500
ppy = (x - hap * 500) // 5

print(hap * 1000 + ppy * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
s = [500,5]
y = [1000,5]
cnt = 0
for i in range(2):
        t = n//s[i]
        n -= t*s[i]
        cnt += t*y[i]

    

print(cnt)

Submission status: Accepted

Solution code:

def main():
	happy_count = 0
	money = int(input())
	happy_count = (money // 500) * 1000
	money -= (money//500) * 500
	happy_count += (money//5) * 5
	print(happy_count)
		

if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
x = int(input())

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

print(a*1000+b*5)

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())
BG, mod = divmod(x, 500)
SG = mod// 5
HP = BG * 1000 + SG * 5
print(HP)

Submission status: Accepted

Solution code:
X = int(input())

q = X // 500
mod = X % 500

mmod =  mod // 5
mmmod = mmod * 5

print(mmmod+q*1000)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

def main():
    *X, = map(int, open(0).read().split())
    # 500円硬貨の数a
    a = X[0] // 500
    # 5円硬貨の数b
    b = (X[0] % 500) // 5
    # 嬉しさH
    H = a * 1000 + b *5
    print(H)



main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

max = 0
for i in range(X//500+1):
    happy = 1000*i + ((X-500*i)//5)*5
    if max < happy:
        max = happy

print(max)

Submission status: Accepted

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

print(a+b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())

coins500 = int(money/500)
coins5 = int(int(money%500)/5)

happiness = (coins500*1000)+(coins5*5)

print(happiness)

Submission status: Accepted

Solution code:
N = int(input())
fiveh = (N-(N%500))/500
tfiveh = fiveh*(1000)
five = ((N%500)-((N%500)%5))/5
tfive = five*5
print(int(tfiveh)+int(tfive))

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())
s = x % 500
print((((x-s)// 500)*1000) + ( s-(s%5)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

c_500=0
c_5=0


while x >= 500:
    x = x - 500
    c_500 += 1

while x >= 5:
    x = x- 5
    c_5 += 1



happy = c_500*1000 + c_5 * 5

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

print(joy)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

h500 = (X // 500) * 1000
h5 = ((X % 500) // 5) * 5

print(h500 + h5)

Submission status: Accepted

Solution code:
X = int(input())

happy = 0

happy += int(X/500) * 1000
X = X % 500

happy += int(X/5) * 5

print(happy)

Submission status: Accepted

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

print(int(a*1000+c*5))

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())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import math

sys.setrecursionlimit(10 ** 6)

input_line = input()
x = int(input_line)

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

ans += (x // 5) * 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

points = 0

points += 1000 * (X//500)

# print(points)

if X > (X//500)*500:
    tm = X - (X//500)*500
    points += 5 * ((tm)//5)

print(points)

Submission status: Accepted

Solution code:
X = int(input())

d_500, m = divmod(X, 500)
d_5, m = divmod(m, 5)
print(d_500 * 1000 + d_5 * 5)

Submission status: Accepted

Solution code:
x= int(input())

#x//500は商、x%500は余り
quot = x//500
rem = x%500

print((1000 * quot) + (rem//5 * 5) )

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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())

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
x = int(input())
ans500 = math.floor(x / 500) * 1000
ans5 = math.floor((x % 500) / 5) * 5
print(ans500 + ans5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
r = x % 500
a = x // 500

b = r // 5

ans = a * 1000 + b * 5
print(ans)

Submission status: Accepted

Solution code:
money = int(input())

num_of_five_hundred, rest = divmod(money, 500)
num_of_five = int(rest / 5)

print(num_of_five_hundred*1000 + num_of_five*5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())
ans,cal,cal2=0,0,0

while(X>=5):
    if X>=500:
        X=X-500
        cal+=1
    else :
        X=X-5
        cal2+=1


ans=cal*1000+cal2*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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:
x = int(input())
count = 0

while (x >= 500):
    count += 1000
    x = x-500
while (x >= 5):
    if x > 5:
        count += 5
        x = x-5
print(count)

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    n_hund = x // 500
    n_five = (x - 500 * n_hund) // 5
    print(1000 * n_hund + 5 * n_five)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x =  int(input())

fh = x//500
f = (x - fh*500)//5

print(int(fh*1000 + f*5))

Submission status: Accepted

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

Submission status: Accepted

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

while(X>=5):
  ha+=5
  X-=5
  
print(ha)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

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

print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
DATA = """
1000000000
""".split("\n")

def get_debug_line():
	for i in DATA:
		yield i

if 1:
	get_line = input
else:
	get_line = get_debug_line().__next__
	get_line()

X = [int(i) for i in get_line().strip().split(" ")][0]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = (int(input()))
ans1 = 0
ans2 = 0
while num >= 500:
    ans1 += 1
    num -= 500

while num >= 5:
    ans2 += 1
    num -= 5

print((ans1*1000)+(ans2*5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x= int(input())
eq=0
eq= x//500
eq2= eq*1000
eq3= x%500
eq4= eq3//5
eq5= eq4*5
print(eq2+eq5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

    X = int(input())
    ans = 1000*(X // 500) + 5 *((X - X//500 *500) // 5)
    return ans

if __name__ == '__main__':
    print(main())

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())
print((x//500)*1000+x%500//5*5)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(X: int):
    ans = 0
    ans += (X // 500)*1000
    X = X % 500
    ans += (X//5)*5
    print(ans)
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

q1, mod1 = divmod(x, 500)
q2, mod2 = divmod(mod1, 5)

print(q1*1000 + q2*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())

happy = 0
th = num//500
#print(th)

happy = happy + 1000*th
num = num - 500*th
#print(num)
fv = num//5
#print(fv)
happy = happy + fv*5

print(happy)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(a*1000+b*5)

Submission status: Accepted

Solution code:
from sys import stdin

X = list(map(int, (stdin.readline().strip().split())))[0]
count=0
while(True):
    num=0
    if X//500>=1:
        num=X//500
        X-=500*num
        count+=1000*num
        continue
    if X//5>=1:
        num=X//5
        X -= 5 * num
        count += 5*num
    else:break
print(count)

Submission status: Accepted

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
X = INT()
ans = X//500*1000

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

u = 1000*a + 5*c
print(u)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
cnt = 0
A = N//500
B = (N%500)//5


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

Submission status: Accepted

Solution code:
x=int(input())

happy=0

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

print(happy)

Submission status: Accepted

Solution code:
x = int(input())
if x == 0:
    print(0)
else:
    happiness = 0

    y500 = x // 500
    happiness += y500 * 1000

    x -= 500 * (x//500)

    y5 = x // 5
    happiness += y5 * 5
    x -= 5 * (x // 5)

    print(happiness)

Submission status: Accepted

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

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:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
pt_500 = 1000
pt_5 = 5
pt_sum = 0

money = int(input())

pt_sum = pt_sum + (money//500)*pt_500 + ((money%500)//5)*pt_5

print(pt_sum)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

h = 0

while x != 0:
    if x >= 500:
        h += 1000
        x -= 500
        continue
    elif x >= 5:
        h += 5
        x -= 5
    else:
        break
        
print (h)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

if s < 500:
    happy5 = s // 5
    happy = 5 * happy5
    print(happy)
else:
    happy500 = s//500
    
    happy5 = s%500
    happy5 = happy5//5
    
    happy = 1000*happy500 + 5*happy5
    print(happy)

Submission status: Accepted

Solution code:
s=int(input())
tot=0

tot+=(s//500)*1000
s-=tot/2
tot+=(s//5)*5

print(str(int(tot)))

Submission status: Accepted

Solution code:
inp = input()
inp1 = int(inp)
gohyaku = inp1 // 500
amari = inp1 % 500
gozyu = amari // 5
print(gohyaku * 1000 + gozyu * 5)

Submission status: Accepted

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

Submission status: Accepted

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

ans += 1000 * (X // 500)

X %= 500

ans += 5 * (X // 5)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

money = a * 1000 + b * 5
print(money)

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())
fhun = X//500
amari = X % 500
fiv = amari//5
ure = fhun*1000 + fiv*5

print(ure)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money=int(input())
happines=0
while money>=500:
  happines+=1000
  money-=500
while money>=100:
  happines+=100
  money-=100
while money>=5:
  happines+=5
  money-=5
print(happines)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
total_yen = int(input())
n = int(total_yen/500)
p = n*1000
m = int((total_yen%500)/5)
q = m*5
print(p+q)