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:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
X = I()
m500 = X//500
rest = X - 500 * m500
print(m500 * 1000 + 5 * (rest//5))

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

n_500 = int(x / 500)
h = 1000 * n_500
x -= 500 * n_500

n_5 = int(x / 5)
h += 5 * n_5

print(int(h))

Submission status: Accepted

Solution code:
def atc_160b(X: int) -> int:
    return X // 500 * 1000 + X % 500 // 5 * 5


X_input = int(input())
print(atc_160b(X_input))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
d,m=divmod(n,500)
print(d*1000+m//5*5)

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

div_500, x = divmod(x, 500)
div_5, x = divmod(x, 5)

ans = div_500 * 1000 + div_5 * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

five_hundred = int(X / 500)
five = int((X - five_hundred*500)/5)
print(five_hundred*1000+five*5)

Submission status: Accepted

Solution code:
X = int(input())

# 500円硬貨 1枚につき 1000、5円硬貨 1枚につき 5 の 嬉しさ を得ます。
# X円を持っています。嬉しさの最大値を出力せよ。

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

Submission status: Accepted

Solution code:
# B - Golden Coins

# X
X = int(input())

kiri_happy = X // 500
inaho_happy = (X - (500 * kiri_happy)) // 5

answer = (kiri_happy * 1000) + (inaho_happy * 5)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
happy = 0
big_fun = 0
small_fun = 0
big_fun = X // 500
X = X % 500
small_fun = X // 5

happy = big_fun * 1000 + small_fun * 5

print(happy)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

five_hand = 500
five = 5
glad = 0

if x >= five_hand:
    glad = glad + (x // five_hand) * 1000
    x = x % five_hand

if x >= five:
    glad = glad + (x // five) * 5
    x = x % five

print(glad)

Submission status: Accepted

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

Submission status: Accepted

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

# 500で割った商*1000happy
g_happy += 1000 * (x // 500)
# 500で割った商*500をｘから引く
x -= 500 * (x // 500)
# 5で割った商*5happy
g_happy += 5 * (x // 5)
print(g_happy)

Submission status: Accepted

Solution code:
x = int(input())

bigmoney_number = x // 500
bigmoney = x // 500 * 1000
smallmoney = (x - bigmoney_number * 500) // 5 * 5

print(bigmoney + smallmoney)

Submission status: Accepted

Solution code:
X = int(input())

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

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())

count_div_500, left_after_500 = divmod(money, 500)
count_div_5, left_after_5 = divmod(left_after_500, 5)

print(count_div_500 * 1000 + count_div_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def answer(x: int) -> int:
    dict = {500: 1000, 5: 5}
    happiness = 0

    for coin in sorted(dict, reverse=True):
        q, x = divmod(x, coin)
        happiness += dict[coin] * q

    return happiness


def main():
    x = int(input())
    print(answer(x))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    fh = X // 500
    X = X-fh*500
    fv = X//5

    print(fh*1000+fv*5)


main()

Submission status: Accepted

Solution code:
X = int(input())

a =  X // 500 * 1000    # 500円の枚数 × 嬉しさ1000
b = (X % 500)// 5 * 5    # 5円の枚数 × 嬉しさ5

print(a + b)

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

sum = 0
gohyakumai =X//500
#print (gohyakumai)
sum = gohyakumai*1000
#print (sum)
goenmai = (X%500)//5
#print (goenmai)
sum = goenmai *5 +sum

print (sum)

Submission status: Accepted

Solution code:
X=int(input())

def answer(X:int):
    return(int(X/500)*1000+int(X%500/5)*5)

print(answer(X))

Submission status: Accepted

Solution code:
x = int(input())

cnt_500 = 0
cnt_5 = 0
while x > 4:
    if x >= 500:
        x -= 500
        cnt_500 += 1
    else:
        x -= 5
        cnt_5 += 1

print(1000*cnt_500+5*cnt_5)

Submission status: Accepted

Solution code:
X = int(input())

gohyaku = X // 500
X = X - (gohyaku * 500)
goen = X // 5

print(gohyaku * 1000 + goen * 5)

Submission status: Accepted

Solution code:
# 金額を取得
money = int(input())

# 嬉しさ指数を計算し出力
hcnt_500 = money // 500
money = money - (hcnt_500 * 500)
hcnt_5 = (money // 5)
hcnt = (hcnt_500 * 1000) + (hcnt_5 * 5)
print(hcnt)

Submission status: Accepted

Solution code:
X = int(input())

happy = X // 500 * 1000
happy += X % 500 // 5 * 5

print(happy)

Submission status: Accepted

Solution code:
X=int(input())

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

print(joy)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

n1 = 0
n2 = 0

while k >= 500:
    n1 += 1
    k -= 500

while k >= 5:
    n2 += 1
    k -= 5

ans = n1 * 1000 + n2 * 5
print(ans)

Submission status: Accepted

Solution code:

def main():
    x = int(input())
    sum_m=0
    while x>=500:
        x -= 500
        sum_m+=1000
    while x >=5:
        x -= 5
        sum_m+= 5
    print(sum_m)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
money = int(input())

gohyakuen = money // 500

goen = (money-(gohyakuen*500)) // 5

happy = 1000 * gohyakuen + 5 * goen

print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC160

X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
x = int(input())
fh=x//500
x = x - (500*fh)
f = x//5
print(1000*fh+5*f)

Submission status: Accepted

Solution code:
x = int(input())

x, xm = divmod(x, 500)
y = xm // 5
print(x*1000 + y*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())
hap = x // 500
hap2 = (x - hap*500)//5
ans = hap*1000 + hap2*5
print(ans)

Submission status: Accepted

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

print(a*1000+c*5)

Submission status: Accepted

Solution code:
x = int(input())

hc500 = x //  500
hc5 = (x - 500*hc500) // 5

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
gohyaku=0
goen=0
while x>5:
    x-=500
    gohyaku+=1
if x==5:
    goen+=1
elif 0<=x<5:
    pass
elif x<0:
    x+=500
    gohyaku-=1
    while x>=5:
        goen+=1
        x-=5
print(gohyaku*1000+goen*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

q, r = divmod(X, 500)
H = q * 1000 + ((r // 5) * 5)
print(H)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

c_500 = x // 500
r_500 = x % 500
c_5 = r_500 // 5

print(c_500 * 1000 + c_5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

c_500 = 0
c_5 = 0
while True:
    temp = x - 500
    if temp < 0:
        break
    else:
        c_500 += 1
        x = temp

while True:
    temp = x - 5
    if temp < 0:
        break
    else:
        c_5 += 1
        x = temp

print(c_500 * 2 * 500 + c_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())
happy = 0

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

happy += (X // 5) * 5

print(happy)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify

import itertools
import math, fractions
import sys, copy

def L(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline().rstrip())
def SL(): return list(sys.stdin.readline().rstrip())
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI1(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return [list(x) for x in sys.stdin.readline().split()]
def R(n): return [sys.stdin.readline().strip() for _ in range(n)]
def LR(n): return [L() for _ in range(n)]
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def LIR1(n): return [LI1() for _ in range(n)]
def SR(n): return [SL() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]

def perm(n, r): return math.factorial(n) // math.factorial(r)
def comb(n, r): return math.factorial(n) // (math.factorial(r) * math.factorial(n-r))

def make_list(n, *args, default=0): return [make_list(*args, default=default) for _ in range(n)] if len(args) > 0 else [default for _ in range(n)]

dire = [[1, 0], [0, 1], [-1, 0], [0, -1]]
dire8 = [[1, 0], [1, 1], [0, 1], [-1, 1], [-1, 0], [-1, -1], [0, -1], [1, -1]]
alphabets = "abcdefghijklmnopqrstuvwxyz"
ALPHABETS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
MOD = 1000000007
INF = float("inf")

sys.setrecursionlimit(1000000)

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
 
a = X // 500 # 500円硬貨の枚数
X = X % 500 # 端数
b = X // 5 # 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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

X = int(input())
SUM = 0


(X * 1000 / 500)

Z = X // 500
A = X % 500
SUM = SUM + (Z * 1000)

B = A // 5
SUM = SUM + (B * 5)

print(int(SUM))

Submission status: Accepted

Solution code:
X = int(input())

print(2*X - X%500 - X%5)

Submission status: Accepted

Solution code:
X = int(input())

A = 0
B = 0

if X >= 500:
    A = X // 500
    X = X % 500
if X >= 5:
    B = X // 5
    X = X % 5

print(A * 1000 + B * 5)

Submission status: Accepted

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

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

print(Happiness)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(cnt)

Submission status: Accepted

Solution code:
n=int(input())

if n>=500:
	s=(n//500)*1000
	ans=n-(s//2)
	s+=(ans//5)*5;
	print(s)
	
else:
	print((n//5)*5)

Submission status: Accepted

Solution code:
import sys
from sys import exit
from math import gcd, factorial, ceil, floor, sqrt
from bisect import bisect_left, bisect_right
from copy import deepcopy
from heapq import heapify, heappop, heappush
from itertools import permutations, combinations, product, accumulate
from collections import defaultdict, deque
sys.setrecursionlimit(10**7)

ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
A = X // 500
B = X % 500

C = B // 5

ans = A * 1000 + C * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

p = X // 500
q = X % 500
r = q // 5

print(p*1000+r*5)

Submission status: Accepted

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

Submission status: Accepted

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

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

    ans = coin_500 * 1000 + coin_5 * 5

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

shou500 = n//500

shou5 = (n-shou500*500)//5

print(shou500*1000+shou5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# ABC160-B

import sys
def I(): return int(sys.stdin.readline().rstrip())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
a=x//500
x=x%500
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:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

X = int(input())
big_coin, amari = divmod(X, 500)
print(big_coin*1000+(amari//5)*5)

Submission status: Accepted

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

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

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

X = int(sys.stdin.readline())

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

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし

X = I()
X -= X % 5
X //= 5
print(1000*(X//100) + 5*(X % 100))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

div, mod = divmod(x, 500)

print(div * 1000 + mod // 5 * 5)

Submission status: Accepted

Solution code:
x=int(input())

cnt = x//500

x-=cnt*500

print(5*(x//5) + 1000*cnt)

Submission status: Accepted

Solution code:
def LI():
    return list(map(int, input().split()))


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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
import numpy as np

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

Submission status: Accepted

Solution code:
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math

#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
  return int(readline())
n = I()
m500 = n//500
n -= 500 * m500
m5 = n//5
print(1000 * m500 + m5 * 5)

Submission status: Accepted

Solution code:
# 2:01
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())
ans = 0

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

print(ans)

Submission status: Accepted

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

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

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())
n = X//500
m = X%500
n1 = m//5
print(n*1000+n1*5)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 8)
ini = lambda: int(sys.stdin.readline())
inl = lambda: [int(x) for x in sys.stdin.readline().split()]
ins = lambda: sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print("\033[33m", *a, "\033[0m", **dict(file=sys.stderr, **kw))


def solve():
    x = ini()
    a = x // 500
    ans = a * 1000
    x %= 500
    b = x // 5
    ans += b * 5
    debug(a, b)
    return ans


print(solve())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
s = int(input())

c = s // 500
d = s % 500

e = d //5

h = c*1000 + e*5

print(h)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
X = int(input())

c500 = X // 500
c5 = (X -(c500 * 500)) // 5
answer = (c500 * 1000) + (c5 * 5)

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if '__main__' == __name__:
    resolve()

Submission status: Accepted

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

happiness = 0
X_remaining = X

happiness = happiness + (int(X_remaining / 500)*1000)
X_remaining = X_remaining % 500

happiness = happiness + (int(X_remaining / 5)*5)

print(happiness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

money1 = x // 500
x %= 500
money2 = x // 5

ans = money1 * 1000 + money2 * 5
print(ans)

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int, sys.stdin.readline().rstrip().split())
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 - ((X // 500) * 500)) // 5) * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

ans=0
ans=A*1000+B*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

print(hundred*1000+five*5)

Submission status: Accepted

Solution code:
X = int(input())

yen_500 = X // 500
yen_5 = (X % 500) // 5

print(yen_500 * 1000 + yen_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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