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

Submission status: Accepted

Solution code:
coin = int(input())
fivet_yen = 0
five_yen = 0
if coin == 0:
    print(0)
else:
   while(coin > 0):
    if coin >= 500:
        coin = coin - 500
        fivet_yen = fivet_yen + 1000
    else:
        if coin >= 5:
            coin = coin - 5
            five_yen   = five_yen + 5
        else:  
            coin = coin - 1
   print(fivet_yen + five_yen)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

n_500 = n // 500
n_ = n % 500
n_5 = n_ // 5

print(1000 * n_500 + 5 * n_5)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

X = int(input())

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

print(1000*a + 5*b)

Submission status: Accepted

Solution code:
X = int(input())   #ｘ円を持っています

count = 0  #嬉しさ
count = (X//500)*1000
amari = X%500
count += (amari//5)*5

print(count)

Submission status: Accepted

Solution code:
inputText1 = input()
# inputText1 = "1000000000"
inputNumber1 = int(inputText1)
c500 = 0
c5 = 0
c500 = inputNumber1 // 500
inputNumber1 = inputNumber1 % 500
c5 = inputNumber1 // 5
print((c500 * 1000) + (c5 * 5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
import math
X = int(input())
LX = X / 500
Amari = X % 500
SX = Amari / 5

print(math.floor(LX) * 1000 + math.floor(SX)* 5)

Submission status: Accepted

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

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 numpy as np
X = int(input())

A = int(X / 500)
B = int(int(X % 500) / 5)

print(A * 1000 + B * 5)

Submission status: Accepted

Solution code:
X = int(input())

num_500 = int(X/500)
num_5 = int((X - num_500*500)/5)
happy = num_500*1000 + num_5*5
print(happy)

Submission status: Accepted

Solution code:
n=int(input())

x=0
while(n>=5):
	if (n>=500):
		x+=1000;
		n-=500;
	elif(n>=5):
		x+=5;
		n-=5;
print(x)

Submission status: Accepted

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

Submission status: Accepted

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

c=S//500
g =S%500
k =g//5
h =1000*c +5*k
print(h)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
res = 0
while x > 4:
    if x >=500:
        res += 1000
        x-=500
    else:
        while x>= 5:
            x -= 5
            res+= 5
print(res)

Submission status: Accepted

Solution code:
from sys import stdin

x = int(stdin.readline().rstrip())

counter = 0
for i in range(2000000):
    if x - 500 >= 0:
        x = x - 500
        counter += 1000
    else:
        break
for i in range(102):
    if x - 5 >= 0:
        x = x - 5
        counter += 5
    else:
        break

print(counter)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

s_500 = int(s / 500)
s_5   = int((s-s_500*500) / 5)

print(s_500*1000 + s_5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

x = int(input())

p = 0
p += math.floor(x/500)*1000

x -= p/1000*500
p += math.floor(x/5)*5

print(p)

Submission status: Accepted

Solution code:
X= int(input())

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

print(happy)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 19 22:37:09 2019

@author: lucifer
"""
n=int(input())
if n%500==0:
  print(1000*int(n/500))
else:
  s=int(n/500)
  x=1000*s+int((n-(s*500))/5)*5
  print(x)

Submission status: Accepted

Solution code:
import sys

for X in sys.stdin:
    X=int(X)
    res=(int(X/500))*1000 +int((X%500)/5)*5
    print(res)

Submission status: Accepted

Solution code:
x = int(input())
f = int(x/500) 

if x % 500 != 0:
    c = int((x-500*f)/5)
    print(1000*f + 5*c)
elif x % 500 == 0:
    print(1000*f)

Submission status: Accepted

Solution code:
c=int(input())
u=0
if c%500<500:
    u+=(1000*(c//500))
    x=c-(c//500*500)
if x%5<5:
    u+=(5*(x//5))

print(u)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

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

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())
n500 = X//500
l_after_500 = X-500*n500
n5 = l_after_500//5
ans = 1000*n500 + 5*n5
print(ans)

Submission status: Accepted

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

if x >= 500:
    golden_coins += (x // 500) * 1000
    x %= 500

if x >= 5:
    golden_coins += (x // 5) * 5
    x %= 5
print(golden_coins)

Submission status: Accepted

Solution code:
tot = int(input().strip())

n_500, rem = divmod(tot, 500)
n_5 = rem // 5

print(str(n_500 * 1000 + n_5 * 5))

Submission status: Accepted

Solution code:
X = int(input(""))

nOf1000 = X//500*1000
remainMo = X%500
nOf500 = remainMo//5*5

print(nOf1000+nOf500)

Submission status: Accepted

Solution code:
a=int(input())
k=0
c=a//500
d=a%500
s=d//5
s1=a-d
print(c*1000+s*5)

Submission status: Accepted

Solution code:
x = int(input())

hapiness1000 = (x//500)*1000
hapiness5 = ((x%500)//5)*5

print(hapiness1000+hapiness5)

Submission status: Accepted

Solution code:
X = int(input())
a_500 = 0
a_5 = 0

if(X >=500):
    a_500 = X//500
    X = X - 500*a_500
else:
    pass

if(X >=5):
    a_5 = X//5
    X = X - 5*a_5
else:
    pass

ans = 1000*a_500 + 5*a_5
print(ans)

Submission status: Accepted

Solution code:
a=int(input())
h=0
if a>=500:
	c=a//500
	h+=c*1000
	a-=c*500

if a>=5:
	d=a//5
	h+=d*5
	a-=d*500

print(h,end="")

Submission status: Accepted

Solution code:
x = int(input())

a,b = divmod(x,500)
b = int(b/5)

print(a * 1000 + b * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
happiness = 0
while X > 0:
    if X >= 500:
        temp = int(X / 500)
        X = X - (500 * temp)
        happiness = 1000 * temp
    else:
        temp = int(X / 5)
        X = X - (500 * temp)
        happiness = happiness + (5 * temp)
        break
print(happiness)

Submission status: Accepted

Solution code:
S = int(input())
happy1000 = int(S/500)

happy5 = int((S-happy1000*500)/5)

print(happy1000*1000+happy5*5)

Submission status: Accepted

Solution code:
n=int(input())
q, mod = divmod( n,500)
gm, mad =  divmod(mod,5)

if mod==0:
     print(q*1000)
elif  mod!=0:
    print(q*1000+gm*5)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
Hapt=0
if(N>=5):
  Hapt=Hapt+(N//500)*1000 + ((N%500)//5)*5
else:
  Hapt=0
print(Hapt)

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

Submission status: Accepted

Solution code:
X = int(input())

res_500 = X // 500

rem_500 = X % 500

res_5 = rem_500 // 5

print(1000 * res_500 + 5 * res_5)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin


def main():
    X = int(stdin.readline())

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
i = int(input())
big = i // 500
last = i - (big*500)
mini = last // 5

print((big*1000)+(mini*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#入力
##1*1行列
X=int(input())#1*1の整数を格納

T=X//500
S=(X%500)//5

print((T*1000)+(S*5))

Submission status: Accepted

Solution code:
x = int(input())

# print(x)

div, mod = divmod(x, 500)

# print(div)
# print(mod)

divdiv, modmod = divmod(mod, 5)

# print(divdiv)
# print(modmod)

print((div * 1000) + (divdiv * 5))

Submission status: Accepted

Solution code:
x = int(input())
m500 = 0
m5 = 0
if (x >= 500):
    m500 = x // 500
x = x - m500 * 500
if (x >= 5):
    m5 = x // 5

ans = m500 * 1000 + m5 * 5
print(ans)

Submission status: Accepted

Solution code:
X=input()
y=int(X)
z=0
while y>=500:
   y-=500
   z+=1
a=0
while y>=5:
    y-=5
    a+=1
   
result=z*1000+a*5
str_result=str(result)
print(str_result)

Submission status: Accepted

Solution code:

def main():
    pocket = int(input())

    if(pocket<5):
        num_500 = 0
        num_005 = 0
    elif(pocket<500):
        num_500 = 0
        num_005 = int(pocket/5)
    else:
        num_500 = int(pocket/500)
        num_005 = int((pocket-(500*num_500))/5)

    val = 1000*num_500 + 5*num_005

    print(val)

main()

Submission status: Accepted

Solution code:
#500=1000, 5=5
X = int(input())
if X<500:
    print((X//5)*5)
else:
    print((X//500)*1000+((X%500)//5)*5)

Submission status: Accepted

Solution code:
import math
X = int(input())
A = X/500
A=math.floor(A)
Q=1000*A
D=A*500
Y=X-D
B = Y/5
B = math.floor(B)
B= 5*B
print(int(Q+B))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
sen = a // 500
go = (a % 500) // 5
print('{}'.format(sen*1000+go*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
coins = [500, 5, 100, 50, 10, 1]
uresimi = {500: 1000, 5: 5}


def get_uresimi(money, coin_type):
    coin_count = money // coin_type
    if coin_count == 0:
        return 0, money
    surplus = money % (coin_type * coin_count)
    uresisa = uresimi.get(coin_type, 0) * coin_count
    return uresisa, surplus


m = int(input())
uresii = 0
for c in coins:
    u, m = get_uresimi(m, c)
    uresii += u

print(uresii)

Submission status: Accepted

Solution code:
X = int(input())

uresi = (X // 500) * 1000
X = X % 500

uresi += (X // 5) * 5
X = X % 5

print(uresi)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
S = int(input())
G = 500
GG = 5

g_count = 0
gg_count= 0

while S >= G:
  S = S - G
  g_count += 1
while S >= GG:
  S = S - GG
  gg_count += 1
print(g_count*1000 + gg_count*5)

Submission status: Accepted

Solution code:
x=int(input())

h=0

h1=int(x/500)

x-=h1*500

h+=h1*1000

h2=int(x/5)

h+=h2*5

print(h)

Submission status: Accepted

Solution code:
X = int(input())

out = 0
while X >= 500:
  out += 1000
  X -= 500

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

Submission status: Accepted

Solution code:
import math

X = int(input())
total_500 = 0
total_5 = 0
total_count = 0

if(X >= 500):
    total_500 = math.floor(X/500)
    total_count += total_500 * 1000
    X -= total_500 * 500

if(X >= 5):
    total_5 = math.floor(X/5)
    total_count += total_5 * 5
    X -= total_5 * 5

print(total_count)

Submission status: Accepted

Solution code:
K = 0
N = 0
N = int(input())
if N >= 500:
  K = N // 500
  N = N - (500*K)

L = N // 5

M = K * 1000 + L * 5
print(M)

Submission status: Accepted

Solution code:
x = int(input())
a = 0
if x/5 >= 1:
    print(a+x//500*1000+x%500//5*5)
else:
    print("0")

Submission status: Accepted

Solution code:
import sys; sys.setrecursionlimit(2147483647); input = sys.stdin.readline
from math import floor, ceil, sqrt, factorial, log
from collections import Counter, defaultdict, deque
from operator import itemgetter
INF = float('inf'); MOD = 10**9+7
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(MI())
def LIR(n): return [LI() for i in range(n)]
def IS(): return input().rstrip()

def main():
    X = I()
    a = 0
    if X >= 500:
        a += (X//500)*1000
        X = X%500
    if X >= 5:
        a += (X//5)*5
    print(a)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

s=0
t=0

if X>=500:
    s=1000*(X//500)

if  (X-500*(X//500))>=5:
    b=(X-500*(X//500))//5
    t=5*b

print(int(s+t))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = int(input())
Happy = X//500*1000+X%500//5*5
print(Happy)

Submission status: Accepted

Solution code:
x = int(input())

fivehun = int(x / 500)
x = x % 500
five = int(x / 5)

print(fivehun*1000+five*5)

Submission status: Accepted

Solution code:
s = int(input())
r = s% 500
print(s//500 * 1000 + r // 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:
from sys import stdin,stdout

input = stdin.readline
print = stdout.write

n = int(input())

coins = [500,5]
d = {500:1000,5:5}

ans = 0

for i in coins:
    if i<=n:
        
        ans+= ((n//i) * d[i])
        n = n%i
        
print(str(ans))

Submission status: Accepted

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

while X > 0:
    if X - 500 >= 0:
        happy += 1000 * (X // 500)
        X -= 500 * (X // 500)
    elif X - 5 >= 0:
        happy += 5 * (X // 5)
        X -= 5 * (X // 5)
    elif X - 1 >= 0:
        X -= 1

print(happy)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = int(input())
a = (int)(X / 500)
X -= a * 500
b = (int)(X / 5)
score = 1000 * a + 5 * b
print(score)

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

Submission status: Accepted

Solution code:
x=int(input())
c_con=x//500
con=c_con*1000

x=x-500*c_con
x_con=x//5
con+=x_con*5

print(con)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X = int(input())

#Happyness
H = 0

div_500 = X // 500
div_5 = (X - 500 * div_500) // 5

H = 1000 * div_500 + 5 * div_5

print(H)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

# 判定

n = x // 500
m = (x % 500) // 5

ans = 1000*n + 5*m

# 答えの出力
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(4100000)

x = int(input())
a = 1
ans = 0 
while a >= 0:
    if x >= 500:
        x -= 500
        ans += 1000
    else:
        break
while a >= 0:
    if x >= 5:
        x -= 5
        ans += 5
    else:
        break
print(str(ans))

Submission status: Accepted

Solution code:
def main():
    x = int(input())
    ans = 0
    while(x > 5):
        if x >= 500:
            ans += 1000
            x -= 500
        else:
            ans += 5
            x -= 5

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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:
x = int(input())
big = x // 500
small = x % 500 // 5
grace = big*1000 + small*5
print(grace)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=input();
a=int(a);
happy=0;
while a>499:
	a=a-500;
	happy=happy+1000;
while a>4:
	a=a-5;
	happy=happy+5;
print(happy);

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())


y=x%500
z=y%5    
count=(x-y)/500
count1=(y-z)/5
    
print(int(round(1000*count + 5*count1)))

Submission status: Accepted

Solution code:

X = int(input())

n_500 = int(X/500)
n_5 = int((X - n_500 * 500)/5)

print(1000* n_500 + 5 * n_5)

Submission status: Accepted

Solution code:
X = input()

five_h = int(X) // 500
X = int(X)%500

five = int(X) // 5
X = int(X)%5

print(1000*five_h+5*five)

Submission status: Accepted

Solution code:
X = int(input())
# print(X)

count = 0
list = {}
for i in range(10**9):
    if (i * 500) > X:
        list["500"] = (i-1)
        X = X - 500 * (i - 1)
        break
for i in range(10**9):
    if (i * 5) > X:
        list["5"] = (i-1)
        X = X - 5 * (i - 1)
        break

# print(list)

a = list["500"]*1000
b = list["5"]*5

c = a+b


print(c)

Submission status: Accepted

Solution code:
X = int(input())

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

print(c*5 + a*1000)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
ft = 0
f  = 0
#print (money)
while money >= 500:
  money = money - 500
  ft = ft + 1
#print (money)
#print (ft)
while money >= 5:
  money = money - 5
  f = f + 1
#print (money)
#print(f)
happy = ft * 1000 + f * 5
print (happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s=int(input())
h=0
while True:
    if s>=500:
        a=s//500
        h +=1000*a
        s=s%500
        
    elif s>=5:
        a=s//5
        h +=5*a
        s=s%5
    else:
        break
    
print(str(h))

Submission status: Accepted

Solution code:
X=int(input())
a=int(X//500)
b=int((X-(a*500))//5)
H=a*1000+b*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:
i = int(input())
a=int(i/500)
b=int((i-a*500)/5)
print(a*1000+b*5)

Submission status: Accepted

Solution code:
def fun(s):
    a,b=0,0
    a+=s//500
    s=s-(a*500)
    b+=(s//5)
    s=s-(b*5)
    print(a*1000+b*5)
    
s=int(input())
fun(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

d,m = divmod(n,500)

d2,m2 = divmod(m,5)

print(1000 * d + 5 * d2)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

a = x // 500
ans += 1000 * a
x -= 500 * a

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

Submission status: Accepted

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

#Process 500yen:1000, 5yen:5
q500 = x // 500
mod500 = x % 500
q5 = mod500 // 5

#Output
print(q500 * 1000 + q5 * 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())

a = x//500 #amount of 500yen 2
b = x%500 #reminder after 500yen conversion 24
c = b//5 #amount of 5yen coin from b 4
d = (a*1000) + (c*5) #(a x 1000) + (b x 5)

print (d)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

#500円の数
gohyaku = X // 500
X = X-gohyaku * 500
ans = gohyaku * 1000

#5円の数
go = X // 5
ans = ans + go * 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())
#print('X=', X)

p = 0

while X > 4:
  if X > 499:
    N = X // 500
    X = X - 500 * N
    p = p + 1000 * N
  if X > 4:
    n = X // 5
    X = X - 5 * n
    p = p + 5 * n

print(p)

Submission status: Accepted

Solution code:
x=input()
x=int(x)
y1=x//500
y2=(x-y1*500)//5

print(1000*y1+5*y2)

Submission status: Accepted

Solution code:
n = int(input())
s=n//500
r=n%500

r=r//5
print(s*1000+r*5)

Submission status: Accepted

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

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

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

print(a*1000+c*5)

Submission status: Accepted

Solution code:
N = int(input())

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

x = a * 1000 + b * 5

print(x)

Submission status: Accepted

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

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

a=S//500

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

c=a*1000+b*5

print(c)

Submission status: Accepted

Solution code:
X = int(input())
a, a_mod = divmod(X,500)
b, b_mod = divmod(a_mod,5)
ans =  a * 1000 + b * 5 
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
h=0
while n>4:
    if n >=500:
        r=n//500
        h+=1000*r
        n=n%(r*500)
    else:
        r=n//5
        h+=5*r
        n=n%(r*5)
print(h)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def calc(x):
    s=0
    if(x==0):
        s=0
    else:
        p=x//500
        q=x%500
        s=s+p*1000+(q//5)*5
    return s
x=int(input())
print(calc(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

# 標準入力 <int>
X = int(input())

Y500 = 0
Y5 = 0

Y500 = X // 500

x = X % 500

Y5 = x // 5

print((Y500 * 1000) + (Y5 * 5))

Submission status: Accepted

Solution code:
x = int(input())
count = 0
if x >= 500:
  count += (x // 500) * 1000
  t = x % 500
  count += (t // 5) * 5
  print(count)
elif x < 500 and x >= 5:
  count += (x // 5) * 5
  print(count)
else:
  print(0)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

x=int(input())

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

s=(1000*a)+(b)
print(s)

Submission status: Accepted

Solution code:
def main():
    import sys
    X=int(sys.stdin.readline())
    print((X//500)*1000+((X%500)//5)*5)


main()

Submission status: Accepted

Solution code:
X = int(input())

a = X * 0.01 // 5 

pointa = a * 1000

b = X - a * 500


pointb = b // 5 * 5


z = round(pointa + pointb)
print(z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = input()

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

Submission status: Accepted

Solution code:
x=int(input())
hund_number=x//500
hund_happy=hund_number*1000
five_number=(x-hund_number*500)//5
five_happy=five_number*5
sum_happy=hund_happy+five_happy
print(sum_happy)

Submission status: Accepted

Solution code:
i = int(input())
i_500 = divmod(i,500)
i_5 = divmod(i_500[1],5)
print(i_500[0]*1000+i_5[0]*5)

Submission status: Accepted

Solution code:
s=int(input())

#print(s)
happy=0

while(s>=500):
  s=s-500
  happy+=1000
while(s>=5):
  s=s-5
  happy+=5
print(happy)

Submission status: Accepted

Solution code:
temp0=int(input())
n500=int(temp0/500)
temp1=temp0-n500*500
n5=int(temp1/5)
print(n500*1000+n5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import numpy as np
from functools import *
import sys
sys.setrecursionlimit(100000)


def is_kaibun(kaibun):
    for i in range(len(kaibun)//2):
        if kaibun[i] != kaibun[-i-1]:
            return False
    return True


X=int(input())

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

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

Submission status: Accepted

Solution code:
X = int(input())
y_500 = X // 500
x_500 = X % 500
y_5 = x_500 // 5
x_5 = x_500 % 5

z = y_500 * 1000 + y_5 * 5
print(z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n= int(input())


mod = n% 5
n=n-mod

sum=0
s5=n//500
sum+=s5 *1000
n =n-(s5*500)
sum+=n//5 *5 

print(sum)

Submission status: Accepted

Solution code:
# 初期入力
X = int(input())

# 枚数設定
a_500 =0
a_100 =0
a_50 =0
a_10 =0
a_5 =0
a_1 =0

# ５００円を多く持てるように、１００円１０円は持たず、５円を多く持つ
a_500,amari = divmod(X,500)
a_5,amari = divmod(amari,5)

#幸福
koufuku = a_500 * 1000 + a_5 * 5
print(koufuku)

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

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

Submission status: Accepted

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

x = int(input())

ans = 0

q, mod = divmod(x, 500)
ans += q*1000

q, mod = divmod(mod, 5)
ans += q*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())  #数値入力 「N」だけの入力のとき

n500=x//500
rr=x%500
n5=rr//5
print(1000*n500+5*n5)

Submission status: Accepted

Solution code:
X = int(input())

h1k = X // 500

h5 = (X - h1k * 500) // 5

happiness = h1k*1000 + h5*5

print(happiness)

Submission status: Accepted

Solution code:
money = int(input())

h1000 = int(money / 500)
money = money - h1000 * 500
h5 = int(money / 5)

print(h1000 * 1000 + h5 * 5)

Submission status: Accepted

Solution code:
money=int(input())

point=0
point+=int(money/500)*1000
money%=500

point+=int(money/5)*5
money%=5
print(point)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x = int(input())

v_1000 = int(x/500)
v_5 = int((x - 500 * v_1000)/5)

print(int(v_1000*1000 + v_5*5))