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

if n>=500:
  x=n//500
  n=n%500
  cnt+=(1000*x)
cnt+=(5*(n//5))

print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

num_500 = X // 500
num_5 = (X % 500) // 5

print(1000*num_500 + 5*num_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

#500円玉l枚
l=x//500

#5円玉m枚
m=(x%500)//5

happiness=1000*l+5*m
print(happiness)

Submission status: Accepted

Solution code:
X = int(input())

hap = 0
Y = X // 500
hap = hap + Y * 1000

Z = X % 500
W = Z // 5
hap = hap + W * 5

print(hap)

Submission status: Accepted

Solution code:
x = int(input())

c500, r500 = map(int, divmod(x, 500))
c5 = int(r500 / 5)

ans1 = c500 * 1000 + c5 * 5

print(ans1)

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())
tmp = 0

if X >= 500:
    tmp += (X // 500) * 1000
    X = X % 500

if 5 <= X < 500:
    tmp += (X // 5) * 5

print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

if X >= 5:
    cnt += 5 * (X // 5)

print(cnt)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
  a = int(input())
  b = a%500
  c = (a-b)*2
  d = b%5
  e = b-d
  print(c+e)
main()

Submission status: Accepted

Solution code:
x = int(input())

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

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:
#!/usr/bin/env python3
n=int(input())
print(n//500*1000+n%500//5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())
coins = {500: 0, 5: 0}
for coin in coins.keys():
  coins[coin] = x // coin
  if coins[coin] > 0:
    x -= coin * coins[coin]
print(1000 * coins[500] + 5 * coins[5])

Submission status: Accepted

Solution code:
import math

N = int(input())
#print(N)

A = math.floor(N / 500)
#print(A)
N = N - A * 500
#print(N)
B = math.floor(N / 5)
#print(B)

AA = A * 1000
BB = B * 5
print(AA + BB)

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

Submission status: Accepted

Solution code:
x = int(input())

num_of_500 = int(x / 500)
remaining = x - num_of_500 *500
num_of_5 = int (remaining / 5)

happiness = num_of_500 * 1000 + num_of_5 *5
print(happiness)

Submission status: Accepted

Solution code:
X = int(input())

r500 = X // 500
X %= 500
r5 = X // 5

print(r500*1000 + r5*5)

Submission status: Accepted

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

ans += X // 5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

n_500 = x // 500
n_5 = (x - 500 * n_500) // 5

print(1000 * n_500 + 5 * n_5)

Submission status: Accepted

Solution code:
x = int(input())

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

ans += 5 * (x // 5)

print(ans)

Submission status: Accepted

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

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:
#

import sys
input=sys.stdin.readline

def main():
    X=int(input())
    g=(X//500)*1000+((X-(X//500)*500)//5)*5
    print(int(g))
    
    
    
if __name__=="__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
N = int(input())
ans = 0
ans = math.floor(N//500)*1000
N = N % 500
ans = ans+math.floor(N//5)*5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

coin_li = [500,5]

ans = 0
while coin_li:
    coin = coin_li.pop(0)
    if coin==500:
        ans+=x//coin*1000
    if coin==5:
        ans+=x//coin*5
    x = x%coin

print(ans)

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

Submission status: Accepted

Solution code:
import itertools
import functools
import math
from collections import Counter

X = int(input())

p = 0

p_500 = ( X // 500 ) * 1000
X -= ( X // 500 ) * 500
p_5 = ( X // 5 ) * 5

print(p_500+p_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

five_hun=X//500
X = X-(five_hun*500)
five = X//5

print(five_hun*1000+five*5)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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

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


def main():
    print(solve())


if __name__ == '__main__':
    main()

Submission status: Accepted

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

    
print(ans)

Submission status: Accepted

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

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

quotient = int(x / 500)
happiness_500 = 1000 * quotient

resid = x % 500
happiness_5 = (int(resid / 5)) * 5

print(happiness_500 + happiness_5)

Submission status: Accepted

Solution code:
X = int(input())

h = 0

for i in range(X+1):
    if X>=500:
        X -= 500
        h += 1000
    elif 5<=X<500:
        X -= 5
        h += 5
    else:
        print(h)
        exit()

Submission status: Accepted

Solution code:
x = int(input())

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

print(1000*fh+5*f)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())
# list(map(int, input().split()))

X = int(input())
ans = 0
ans += (X // 500) * 1000
X = X % 500
ans += (X // 5) * 5
X = X % 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X=int(input())

Happy=0
tmp=X

#500円
X//=500
Happy+=1000*X
tmp-=500*X

#5円
tmp//=5
Happy+=5*tmp

print(Happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
yen = int(input())
'''
happy= 0
while yen > 499:
  yen -= 500
  happy += 1000

while yen > 4:
  yen -=5
  happy += 5
'''
happy = 1000 * int(yen//500) + 5 * int((yen - (500 * int(yen//500)))//5)

print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 160 B

x = int(input())
n = 0

if x // 500 != 0:
    n += 1000 * (x // 500)
    # print(x // 500)
    x = x % 500

if x // 5 != 0:
    n += 5 * (x // 5)
    # print(x // 5)
    x = x % 5

print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

FHyen = X // 500
Fyen = (X-500*FHyen) // 5

print(1000*FHyen + 5*Fyen)

Submission status: Accepted

Solution code:
x = int(input())
five_h = x // 500
five = (x - 500*five_h)//5

ans = 2*500*five_h + 5*five
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
syojikinn = int(input())
kouka500 = syojikinn / 500
kouka500 = math.floor(kouka500)
syojikinn = syojikinn - kouka500 * 500
kouka5 = syojikinn / 5
kouka5 = math.floor(kouka5)
siawase = kouka500 * 1000 + kouka5 * 5
print(siawase)

Submission status: Accepted

Solution code:
s=int(input())
five=s
five  = ((s-(s//500)*500)//5)*5
s=(s//500)*1000

print(five+s)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

yen_500 = int(x / 500)
rem = x % 500

yen_5 = int(rem /5)

print(yen_500 * 1000 + yen_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
def money(x):
    if x==0:
        return 0
    cnt500=0
    cnt5=0

    while x>=500:
        x-=500
        cnt500+=1
    if x==0:
        return cnt500*1000
    
    while x>=5:
        x-=5
        cnt5+=1
    return cnt500*1000+cnt5*5
print(money(x))

Submission status: Accepted

Solution code:
import numpy as np
def cumsum(x):
    return list(np.cumsum(x))

def cumsum_number(N,K,x):
    ans=[0]*(N-K+1)
    number_cumsum = cumsum(x)
    number_cumsum.insert(0,0)
    for i in range(N-K+1):
        ans[i]=number_cumsum[i+K]-number_cumsum[i]
    return ans
"""
int #整数
float #小数

#for
for name in fruits: #fruitの頭から操作
    print(name)

#リスト
list0 = [] #リスト生成
list0 = [1,2,3,4] #初期化
list0 = [0]*10 #[0,0,0,0,0,0,0,0,0,0]
list1= [i for i in range(10)] #>>> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
list1 = list(map(int, input().split()))　# 複数の入力をリストに入れる
number=[int(input()) for i in range(int(input()))] #複数行の入力をリストに
list1 = list1 + [6, 7, 8] #リストの追加
list2.append(34) #リストの追加　最後に（）内が足される
list.insert(3,10) #リストの追加　任意の位置（追加したい位置,追加したい値）
len(list4) #リストの要素数
max(sa) #list saの最小値
list5.count(2) #リスト(文字列も可）内の2の数
list1.sort() #並び替え小さい順
list1.sort(reverse=True)  #並び替え大きい順
set(list1) #list1内の重複している要素を削除し、小さい順に並べる
sum([2,3,   ,3]) #リストの合計

abs(a) #aの絶対値
max(a,b) min(a,b) #最大値　最小値
text1 = text1.replace("34","test") #text1内の"34"を"test"に書き換える(文字列内の文字を入れ替える)

exit(0) #強制終了

cumsum(リスト) #累積和をリストで返す
cumsum_number(N,K,x) #N個の数が含まれるリストx内のK個からなる部分和をリストで返す
"""
X=int(input())
happy=0
if X>=500:
    happy += 1000*(X//500)
    X -= 500*(X//500)
if X>=5:
    happy += 5*(X//5)
print(happy)

Submission status: Accepted

Solution code:
X = int(input())
go = 0
gohyaku = 0

while X >= 500:
    gohyaku += 1
    X -= 500
    
    
while X >= 5:
    go += 1
    X -= 5
    

ans = (gohyaku * 1000) + (go * 5)
print(ans)

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

u = (x // 500) * 1000
y = (x % 500)
u = u + (y // 5) * 5

print(u)

Submission status: Accepted

Solution code:
import sys
from collections import deque
import numpy as np
import math
sys.setrecursionlimit(10**6)
def S(): return sys.stdin.readline().rstrip()
def SL(): return map(str,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def IL(): return map(int,sys.stdin.readline().rstrip().split())

def Main():
    x = I()
    a = x//500
    x -= a*500
    b = x//5
    print(1000*a+5*b)
    return

if __name__=='__main__':
    Main()

Submission status: Accepted

Solution code:

x = int(input())

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

print(a*1000 + b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X  = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(1000*num500 + 5*num5)

Submission status: Accepted

Solution code:
a=int(input())

L=0
while a >= 500:
    a -= 500
    L += 1000

while a >= 5:
    a-=5
    L+=5
print(L)

Submission status: Accepted

Solution code:
x = int(input())

n500 = x//500
q500 = x%500
n5 = q500//5

print(n500*1000+n5*5)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
#500円通貨1枚につき1000
#5円通貨1枚につき5
#高橋君はx円持ってる
#利用できる通貨は500円,100円,10円,5円,1円
#入力 1024

x=input()
x1=int(x) 

#まず入力を500で何回われるかを数えその回数で割り,残った値を変数に格納
r=int(x1/500)
x2=x1%500

#同じ操作を5でおこなう
r1=int(x2/5)
x3=x2%5

sam=(r*1000)+(r1*5)

print(sam)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500

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

Submission status: Accepted

Solution code:
x = int(input())

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

ans = a * 1000 + b * 5

print(ans)

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

Submission status: Accepted

Solution code:
x = int(input())
happiness = 0
while True:
    if x >= 500:
        x -= 500
        happiness += 1000
    elif x >= 5:
        x -= 5
        happiness += 5
    else:
        print(happiness)
        exit()

Submission status: Accepted

Solution code:
num = int(input())

hap1000 = int(num/500)
hap5    = int((num-hap1000*500)/5)
print(int(1000*hap1000+5*hap5))

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
X=int(input())

ans=0
while X>=5:
    if X>=500:
        ans+=1000
        X-=500
    else:
        ans+=5
        X-=5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
u = 0
coins = [500,5]
u_coin = [1000,5]

for i,coin in enumerate(coins):
  if x > 0:
    u += x // coin * u_coin[i]
    x -= x // coin * coin
print(u)

Submission status: Accepted

Solution code:
# # -*- coding: utf-8 -*-
X = int(input())
n = X//500
m = (X - 500*n)//5

ans = n*1000 + m*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

happy = a * 1000 + b * 5

print(happy)

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

ans = cnt_500 * 1000 + cnt_5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

coin_500 = x // 500
coin_5 = (x-coin_500*500) // 5

print(coin_500 * 1000 + coin_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

A = X//500
D = X - A*500
B = D//5

print(1000*A + 5*B)

Submission status: Accepted

Solution code:
X = int(input())

th = X // 500
X = X -500*th

fi = X // 5

print(1000*th + fi *5)

Submission status: Accepted

Solution code:
n = int(input())

def happy(n):
  s = n//500
  m = (n%500)//5
  print(s*1000 + m*5)

happy(n)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
import sys
input = lambda: sys.stdin.readline().strip()
x = int(input())
print(1000 * (x // 500) + 5 * (x % 500 // 5))

Submission status: Accepted

Solution code:
x = int(input())

count_500 = x//500
count_5 = (x%500)//5

print(1000*count_500 + 5*count_5)

Submission status: Accepted

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


def main():
    x = int(readline().rstrip())
    print((x // 500) * 1000 + ((x - (x // 500) * 500) // 5) * 5)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
# B - Golden Coins
X = int(input())
ans = 1000*(X//500)
X %= 500
ans += 5*(X//5)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def happy():
  x = int(input())
  y = 0 
  z = 0
  
  if x >= 500:

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

      if 5 <= x <500:
        while x >= 5:
          x -= 5
          z +=1
        print(y *1000 +z *5)
        return

    print(y*1000)

  else:
    if x >= 5:
      while x >= 5:
        x -= 5
        z += 1
      print(z*5)

    else:
      print("0")

happy()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
sho = X//500
glad = 0

glad = 1000 * sho
X -= sho*500

sho = X//5
glad += 5*sho

print(glad)

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n = int(input())
a = 0
a += n//500*1000
n -= n//500*500
a += n//5*5
print(a)

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

    return

resolve()

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
s = int(input())
big_g= math.floor(s/500)*1000
small_g = math.floor((s%500)/5)*5
ans = big_g + small_g
print (ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

X = int(input())

_500 = X // 500
_5 = (X % 500) // 5

print(_500 * 1000 + _5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

num_500 = x // 500
num_5 = (x - num_500 * 500) // 5

print(num_500 * 1000 + num_5 * 5)

Submission status: Accepted

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

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

Submission status: Accepted

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

fh = 0
f  = 0

while X > 0:
    if X // 500 > 0:
        num = X // 500
        fh += num
        X -= num * 500
    elif X // 5 > 0:
        num = X // 5
        f += num
        X -= num * 5
    else:
        break

ans = 1000 * fh + 5 * f

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

print(point)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

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())
Y = X // 500
Z = (X - Y * 500) // 5
print(Y * 1000 + Z * 5)

Submission status: Accepted

Solution code:
x = int(input())

acc, x = divmod(x, 500)
print(x//5*5 + acc*1000)

Submission status: Accepted

Solution code:
X = int(input())

#500
X_500 = X // 500 * 1000
#5
X_5 = (X % 500) // 5 * 5

print(X_500 + X_5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()

x = int(N)

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

Submission status: Accepted

Solution code:
#import bisect,collections,copy,heapq,itertools,math,numpy,string
#from operator import itemgetter
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
X = I()
print(X//500*1000+(X%500)//5*5)

Submission status: Accepted

Solution code:
import math

x = int(input())
x500 = math.floor(x/500)
x5 = math.floor((x%500)/5)
print(x500*1000+x5*5)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

a = 0

c_500 = x // 500
c_5 = (x - c_500*500) // 5 


print(c_500*1000 + c_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def actual(x):
    n_500yen, x = divmod(x, 500)

    n_5yen, _ = divmod(x, 5)

    return 1000 * n_500yen + 5 * n_5yen

x = int(input())
print(actual(x))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
coins = [500, 5]
counts = []
for c in coins:
    counts.append(X//c)
    X -= counts[-1] * c
print(counts[0]*1000 + counts[1]*5)