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

num500 = int(x / 500)
num5 = int((x - num500 * 500) / 5)

print(num500 * 1000 + num5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

m500 = x//500
tmp = x - 500*m500
m5 = tmp//5

print(1000*m500 + 5*m5)

Submission status: Accepted

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

A,B=[(X//500) ,(X%500)]
point += A*1000
A,B=[(B//5) ,(B%5)]
point += A*5

print(point)

Submission status: Accepted

Solution code:
X=int(input())

uresisa=0

gohyaku=0
gohyaku=X//500

X=X%500

goen=0

goen=X//5

uresisa=gohyaku*1000+goen*5

print(uresisa)

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():
    x = int(input())

    q1, r1 = divmod(x, 500)
    x -= q1 * 500
    q2, r2 = divmod(x, 5)
    print(q1 * 1000 + q2 * 5)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
x = int(input())

q_1 = x//500
r_1 = x%500

q_2 = r_1//5

print(q_1*1000+q_2*5)

Submission status: Accepted

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

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())
num_500 = X // 500
num_5 = (X - 500 * num_500) // 5

happiness = num_500 * 1000 + num_5 * 5

print(happiness)

Submission status: Accepted

Solution code:
x = int(input())

k = x // 500
h = (x - k * 500) // 5
print(k * 1000 + h * 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())
ha = 0

if x >= 500:
  ha  += (x // 500)*1000
  x %= 500
  
if x >= 5:
  ha += (x // 5)*5
 
print(ha)

Submission status: Accepted

Solution code:
n = int(input())
# nは決まってる1まいにつきだから500or5でわる
print(n//500*1000 + n%500//5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

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

G = X // 500
g = (X%500)//5

print(G*1000+g*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

values=[500,5,1]
coins=[0 for i in range(3)]

for i in range(3):
    coins[i]=X//values[i]
    X-=coins[i]*values[i]
    
total=1000*coins[0]+5*coins[1]

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

c500 = x//500
r = x % 500
c5 = r//5

print(c500*1000+c5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

y500 = x // 500
y5 = (x % 500) // 5

print(y500 * 1000 + y5*5)

Submission status: Accepted

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


#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode('utf-8')

#
#import numpy as np

from itertools import combinations

def main():
	n=II()
	k=n//500
	print(1000*k+(n-k*500)//5*5)


if __name__ == "__main__":
	main()

Submission status: Accepted

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

Submission status: Accepted

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

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

while x>=5:
    x=x-5
    hpy+=5
print(hpy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

a = x//500
x %= 500
b = x//5

print(a*1000 + b*5)

Submission status: Accepted

Solution code:
X = int(input())

num_of_500 = X // 500
num_of_5 = (X % 500) // 5

print(str(num_of_500 * 1000 + num_of_5 * 5))

Submission status: Accepted

Solution code:
x = int(input())

happy = 0
if x/500 >= 1:
    happy += int(x/500)*1000
    x = x - int(x/500)*500
if x/5 >= 1:
    happy += int(x/5)*5
    x = x - int(x/5)*5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())

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

print(b*1000+c*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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:
S = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

H1 = X // 500
H2 = (X % 500) // 5

print(1000*H1 + 5*H2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
total = 0
if n>=500:
    total += (n//500)*1000
    n%=500

if n>=5:
    total += (n//5)*5
    n%=5
print(total)

Submission status: Accepted

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

u += (x - (x % 500) ) * 2

u += (x - (x // 500) * 500 ) // 5 * 5

print(u)

Submission status: Accepted

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

    ans = x // 500 * 1000
    rem = x % 500

    ans += rem // 5 * 5

    print(ans)
resolve()

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

Solution code:
S=int(input())
P=S//500
Q=S%500
R=Q//5
print(1000*P+5*R)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

c500 = x//500

c5 = (x%500)//5

print(c500 * 1000 + c5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500
r_1 = x - 500*a
b = r_1 // 5

c = x //5

if x >= 500:
  print(1000 * a + 5 * b)
elif x >= 5:
  print(5 * c)
else:
  print(0)

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

large_coin = x//500
x -= large_coin*500
small_coin = x//5

print(large_coin*1000+small_coin*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

y = x//500
1000*y

z = (x - 500*y)//5
#print(x,y,z)

print(1000*y + 5*z)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

C500 = X // 500
X = X - C500 * 500

C5 = X // 5
X = X - C5 * 5

print(str(C500 * 1000 + C5 * 5))

Submission status: Accepted

Solution code:
x=int(input())

thousands=(x-x%500)/500
fives=(x%500-(x%500)%5)/5

happiness=int(1000*thousands+5*fives)

print(happiness)

Submission status: Accepted

Solution code:
x = int(input())

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

print(ureshisa)

Submission status: Accepted

Solution code:
import math
x = int(input())
gohyoku = math.floor(x/500)
goen = math.floor((x-500*gohyoku)/5)
print(gohyoku*1000+goen*5)

Submission status: Accepted

Solution code:
X = int(input())

q = X//500
mod = X % 500
qmod = mod//5
happy = q * 1000 + qmod * 5
print(happy)

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

Submission status: Accepted

Solution code:
x = int(input())

a = int(x/500)
x = x - int(a*500)

b = int(x/5)

print(a*1000 + b*5)

Submission status: Accepted

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

    Yens500 = x // 500
    Yens5 = (x-( Yens500*500 )) // 5


    print ((Yens500)*1000 + (Yens5)*5)

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:
x=int(input())
a = x//500
c = x%500
b = c//5

print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

Y = X%500

Z = Y//5

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
NN = N // 500
MM = N % 500
LL = MM // 5
#print(NN, LL)
print(NN * 1000 + LL * 5)

Submission status: Accepted

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

print(ans+5*(x//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())
q , mod = divmod (X , 500)
N = q * 1000
w, e = divmod (mod , 5)
S = w * 5
print (N + S)

Submission status: Accepted

Solution code:
x = int(input())

ha_500 = int(x / 500)
ha_5 = int(int(x % 500) / 5)

print(ha_500 * 1000 + ha_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
k=[500,5]
a1=x//500
x2=x%500
a2=x2//5
print(a1*1000+a2*5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import numpy as np
import scipy.sparse as sps
import scipy.misc as spm
import collections as col
import functools as func
import itertools as ite
import fractions as frac
import math as ma
import cmath as cma
import copy as cp
import sys
def sinput(): return sys.stdin.readline()
def iinput(): return int(sinput())
def imap(): return map(int, sinput().split())
def fmap(): return map(float, sinput().split())
def iarr(n=0):
    if n: return [0 for _ in range(n)]
    else: return list(imap())
def farr(): return list(fmap())
def sarr(n=0):
    if n: return ["" for _ in range(n)]
    else: return sinput().split()
def barr(n): return [False for _ in range(n)]
sys.setrecursionlimit(10**7)
MOD = 10**9 + 7; EPS = sys.float_info.epsilon
PI = np.pi; EXP = np.e; INF = np.inf

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

Submission status: Accepted

Solution code:
money = int(input())

##貰える500円の数を調べる
coin500 = money//500
##貰える5円の数を調べる
coin5 = money%500//5

happiness = 1000 * coin500 + 5 * coin5
print(happiness)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans += x//5 * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
T = X // 500
rem = X - 500 * T
F = rem // 5

print(1000*T + 5*F)

Submission status: Accepted

Solution code:
x=int(input())
y=x%500
z=y%5
a=(x-y)*2
b=(y-z)
print(a+b)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

if(X >= 500):
    a = X//500
    if(X-500*a >= 5):
        b = (X-500*a)//5
else :
    b = X // 5
	
ans = 1000*a + 5*b
print(ans)

Submission status: Accepted

Solution code:
#入力
x=int(input())

#金を500円で割る
a=int(x/500)

#500円分引いた数
b=x-500*a

#残りを5円玉で割る
c=int(b/5)

print(1000*a+5*c)

Submission status: Accepted

Solution code:
X=int(input())

fiveh=(X//500)*1000
rest=X-(X//500)*500
five=(rest//5)*5

print(fiveh+five)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
coin500, X = divmod(X, 500)
coin5, X = divmod(X, 5)
print(1000 * coin500 + 5 * coin5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
total = int(input())
big_coins = math.floor(total/500)
small_coins = math.floor((total - 500 *big_coins) / 5)
print(big_coins * 1000 + small_coins * 5)

Submission status: Accepted

Solution code:
X=int(input())
fh=X//500
X%=500
f=X//5
print(fh*1000+f*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, X = divmod(X, 500)
C, X = divmod(X, 5)
 
print((A * 1000) + (C * 5))

Submission status: Accepted

Solution code:
N = int(input())
A, N = divmod(N, 500)
B, N = divmod(N, 5)
print(A*1000+B*5)

Submission status: Accepted

Solution code:
# -*- coding: <encoding name> -*-

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

Submission status: Accepted

Solution code:
X = int(input())

c1 = int(X/500)
c2 = int((X-(c1*500))/5)

print(c1*1000+c2*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(A*1000+B*5)

Submission status: Accepted

Solution code:
n = int(input())

a = int(n/500)
b = n - 500*a
b = int(b/5)

print(a*1000 + b*5)

Submission status: Accepted

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

A=a*1000+b*5

print(A)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    # 500円をp個、5円をq個とすると。500p+5q=Xが成り立ち、ansは1000p+5qになる
    p = int(X/500)
    q = int((X-p*500)/5)
    ans = 1000*p + 5*q
    print(ans)

main()

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    # 500円をp個、5円をq個とすると。500p+5q=Xが成り立ち、ansは1000p+5qになる
    pmax = int(X/500)
    ans = 0
    tmp = 0
    for p in range(pmax+1):
        q = int((X-500*p)/5)
        tmp = 1000*p + 5*q
        ans = max(ans,tmp)
    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

a,b = divmod(x, 500)
c,d = divmod(b,5)
print(1000*a + 5*c)

Submission status: Accepted

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

        ans = 0

        coins = [500,5]
        happy = [1000,5]

        for i in range(2):
                ans += X//coins[i]*happy[i]
                X = X%coins[i]

        print("{}".format(ans))

if __name__=="__main__":
        main()

Submission status: Accepted

Solution code:
X=int(input())
N=0
n=0
if X==0:
    print(0)
else:
    N=X//500
    n=(X-N*500)//5
    print(N*1000+5*n)

Submission status: Accepted

Solution code:
X = int(input())

# X = 500*x + 5*y + z
x = X // 500
y = (X - 500 * x) // 5
res = 1000 * x + 5 * y

print(res)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

def solve(x):
    coins = x
    happiness = 0
    t = coins // 500

    happiness += t * 1000
    coins -= t * 500

    h = coins // 5
    happiness += h * 5

    print(happiness)

solve(x)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    x = int(input())
    ans = 0
    ans += (x // 500) * 1000
    x = x % 500
    ans += (x // 5) * 5
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

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

if X/500 > 0:
    a = 1000 * math.floor(X/500)
    b = 5 * math.floor((X%500)/5)
    print(a+b)
elif X/5 > 0:
    c = 5 * math.floor(X/5)
    print(c)
else:
    print('0')

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())

a = int(money / 500) * 1000
money = money % 500
b = int(money / 5) * 5

print(a + b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

a=x//500 #500円玉の枚数
b=(x-a*500)//5  #5円玉の枚数

print(1000*a+5*b)

Submission status: Accepted

Solution code:
x=int(input())

if x>=500:
  print(x//500*1000+(x%500)//5*5)
  
else:
  if x>=5:
    print(x//5*5)
    
  else:
    print(0)

Submission status: Accepted

Solution code:
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

x = ni()

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

Submission status: Accepted

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

soo = floor(X/500)
s = floor((X - 500 * soo)/ 5)
print(soo * 1000 + s * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(readline())

div_500,mod_500 = divmod(X, 500)
div_5,mod_5 = divmod(mod_500, 5)

print(div_500*1000 + div_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

X = int(input())

a = int(X/500)
b = int((X-500*a)/5)
print("{}".format(1000*a+5*b))

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

Submission status: Accepted

Solution code:
def f(x):
    joy = x // 500 * 1000
    x %= 500
    joy += x // 5 * 5
    print(joy)

x = int(input())
f(x)

Submission status: Accepted

Solution code:
def main():
    g = int(input())
    p = (g // 500) * 1000
    l = (g % 500) // 5
    p += l * 5
    print(p)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

J = (n//500) * 1000 + (n%500)//5 * 5

print(J)

Submission status: Accepted

Solution code:
a=int(input())
b=a//500
c=(a-b*500)//5
print(b*1000+c*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())
gohyaku=x//500
x=x%500
goen=x//5
print(gohyaku*1000+goen*5)

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


ans = 0

ans += x//500*1000
x1 = x%500
ans += x1//5*5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
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())
print((X // 500) * 1000 + ((X % 500) // 5) * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(ans)

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 = X // 500 * 1000
tmp = X % 500
ans += tmp // 5 * 5

print(ans)

Submission status: Accepted

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

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

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

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

print(y*1000 + a*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())
happy_500 = x //500
happy_50 = (x - happy_500*500) // 5
happy_500 *= 1000
happy_50 *= 5
print(happy_500+happy_50)

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:
n = int(input())

val1 = n//500

val2 = n-val1*500

val3 = val2//5

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = lambda: sys.stdin.readline().strip()

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

main()

Submission status: Accepted

Solution code:
import itertools
import math
import fractions
import functools
x = int(input())
hp = 0

hp = x//500 * 1000
x = x - x//500 * 500

hp += x//5 *5
print(hp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

c1 = X//500
c2 = (X%500)//5

print(1000*c1 + 5*c2)

Submission status: Accepted

Solution code:
X = int(input().rstrip())
c500 = int(X / 500)
c5 = int((X - c500 * 500) / 5)
r = c500 * 1000 + c5 * 5
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a, X= divmod(X, 500)

b, X= divmod(X, 5)

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500

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

Submission status: Accepted

Solution code:
X = int(input())

c500, X = divmod(X, 500)
c5, X = divmod(X, 5)

print(c500 * 1000 + c5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

gh = X // 500
g = (X - gh * 500) // 5

print(gh * 1000 + g * 5)

Submission status: Accepted

Solution code:

x = int(input())

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

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

Submission status: Accepted

Solution code:
# N, K = [int(_) for _ in input().split()]
X = int(input())
print(1000 * (X // 500) + (X % 500) // 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())
print(x//500 * 1000 + x%500 //5 *5)

Submission status: Accepted

Solution code:
x= int(input());  s = 0
while(x>=5):
    if x >= 500:
        s += 1000;        x -= 500
    elif x >= 5:
        s += 5;        x -= 5
print(s)

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

Submission status: Accepted

Solution code:
X = int(input())

Ureshisa = 0

# make as many 500 yen coin as possible
FiveHundredCoins = X//500
Ureshisa += 1000*FiveHundredCoins

# make the rest of the amount as many 5 yen coin as possible
X -= 500*FiveHundredCoins
FiveCoins = X//5
Ureshisa += 5*FiveCoins

print(Ureshisa)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
div500, rem = divmod(int(input()), 500)
print(div500 * 1000 + rem // 5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#abc 160
#b
money = int(input())
a,b = 0,0 # 500yen ->a,  5yen -> b
ln = divmod(money, 500) #(a // b, a % b)
a = ln[0]
b = ln[1]//5
print(a*1000+ b*5)

Submission status: Accepted

Solution code:
X = int(input())

five_hundred = (X//500)

rest = X % 500

five = rest // 5

happines = five_hundred * 1000 + five * 5
print(happines)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

medal_500 = X // 500
medal_5 =  (X % 500) // 5

answer = medal_500*1000 + medal_5*5
print(answer)

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

num = [500, 5]

cnt = 0
while True:
    if X < 500:
        break

    X -= 500
    cnt+=1000

while True:
    if X < 5:
        break

    X -= 5
    cnt+=5

print(cnt)