Problem:


Score : 200 points

Problem Statement

Takahashi loves gold coins. He gains 1000 happiness points for each 500-yen coin he has and gains 5 happiness points for each 5-yen coin he has. (Yen is the currency of Japan.)

Takahashi has X yen. If he exchanges his money so that he will gain the most happiness points, how many happiness points will he earn?

(We assume that there are six kinds of coins available: 500-yen, 100-yen, 50-yen, 10-yen, 5-yen, and 1-yen coins.)

Constraints

0 \leq X \leq 10^9

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

Print the maximum number of happiness points that can be earned.

Sample Input 1

1024

Sample Output 1

2020

By exchanging his money so that he gets two 500-yen coins and four 5-yen coins, he gains 2020 happiness points, which is the maximum number of happiness points that can be earned.

Sample Input 2

0

Sample Output 2

0

He is penniless - or yenless.

Sample Input 3

1000000000

Sample Output 3

2000000000

He is a billionaire - in yen.



Sample input:
1024


Sample output:
2020

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

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

n = 0
while True:
    if X - 500 >= 0:
        n += 1000
    else:
        break
    X -= 500
while True:
    if X - 5 >= 0:
        n += 5
    else:
        break
    X -= 5
print(n)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import ceil, floor
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    x = int(input())
    cnt = 0
    if x >= 500:
        cnt += (x // 500) * 1000
        x %= 500
    if x >= 5:
        cnt += (x// 5)*5
        x %= 5 
    print(cnt)
    return

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

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

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

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

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

Submission status: Accepted

Solution code:
X=int(input())

ans=0
ans+=(X//500)*1000

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip() 

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

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

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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:
X = int(input())
# S = input()
# X1_list = [int(input()) for i in range(N)]
# X2_list = [list(map(int,input().split())) for i in range(N)]

sho500 = X // 500
amari500 = X % 500
sho5 = amari500 // 5
amari5 = sho5 % 5

print(1000 * sho500 + 5 * sho5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

amari1=x//500
amari2=(x-amari1*500)//5


print(amari1*1000+amari2*5)

Submission status: Accepted

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


resolve()

Submission status: Accepted

Solution code:
n = int(input())

coin = [500, 5, 100, 50, 10, 1]

ans = 0
for i in range(6):
    if i == 0:
        ans += (n // coin[i]) * 1000
    if i == 1:
        ans += (n // coin[i]) * 5
    n = n % coin[i]

print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
x = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

X = int(input())

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

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

Submission status: Accepted

Solution code:
x = int(input())
ure1000 = x // 500
ure5 = (x - (ure1000 * 500)) // 5

print(ure1000 * 1000 + ure5 * 5)

Submission status: Accepted

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


def solve(X: int):
    y500 = X // 500
    rest = X % 500
    y5 = rest // 5

    glad = y500 * 1000 + y5 * 5
    print(glad)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    X = int(next(tokens))  # type: int
    solve(X)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans += (x//500)*1000

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

print(ans)

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

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

while x - 5 >= 0:
    ans += 5
    x -= 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

happy_500 = X // 500
happy_5 = (X % 500) // 5

print(1000 * happy_500 + 5 * happy_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

x = int(input())

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

v += 5 * (x // 5)

print(v)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
    x = ni()

    print(x // 500 * 1000 + ((x - (x // 500) * 500) // 5) * 5)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    #n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = list(map(int, input().split()))
    #a = [list(input().split()) for i in range(n)]
    #a = [int(input()) for i in range(n)]
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    s=int(input())
    print((s//500)*1000+((s-(((s//500)*500)))//5)*5)

if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = int(input())
gohyakuen = int(X / 500)
rest = X - gohyakuen * 500

goen = int(rest/5)

print(gohyakuen*1000 + goen*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

A = X // 500

X = X % 500

B = X // 5

calc = A*1000 + B*5

print(calc)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
# ABC160 B

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

    fivehundred = x // 500
    five = (x - (fivehundred * 500)) // 5

    print((fivehundred * 1000) + (five * 5))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())

uresii = 0
uresii += (x // 500) * 1000
n = x % 500
uresii += (n // 5) * 5
print(uresii)

Submission status: Accepted

Solution code:
X = int(input())

p = X // 500 * 1000

p += (X % 500)//5 * 5

print(p)

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())
amari = X % 500

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

Submission status: Accepted

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

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

print(happy)

Submission status: Accepted

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

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

d = a // 5 * 5

print(b + d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

i_i = lambda: int(i_s())
i_l = lambda: list(map(int, stdin.readline().split()))
i_s = lambda: stdin.readline().rstrip()

X = i_i()

ans = 0
ans = int(X / 500) * 1000

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8 ff=unix


def solv(X):
    n500 = X // 500
    n5 = (X % 500) // 5
    ans = 1000 * n500 + 5 * n5
    return ans


if __name__ == "__main__":

    # X
    #
    X = int(input())
    ans = solv(X)

    print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
'''
Created on 2020/03/28

@author: fanta
'''
N = int(input())

out = 0

gohyaku,go = N // 500, (N % 500) // 5

out = 1000 * gohyaku + 5 * go

print(out)

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())
k=n//500
k1=(n%500)
k2=(k1//5)
print((k*1000)+(k2*5))

Submission status: Accepted

Solution code:
x = int(input())

happy_500 = x//500
x %= 500

happy_5 = x // 5

print(happy_500 * 1000 + happy_5 * 5)

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

y500 = x // 500
tmp = x % 500
y5 = tmp // 5

print(y500 * 1000 + y5 * 5)

Submission status: Accepted

Solution code:
'''
.append(要素) リストに要素を追加
.extend(リスト) リストを連結する
.insert(場所,要素) 指定した場所に要素追加
del 配列名[場所]
-1で末尾で末尾から一つ前

sort()
sorted(reverse=true)

配列の初期化
配列名=[a]*n+[b]*m

Decimal()
'''

from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import bisect
import copy
import math
from functools import reduce
from operator import mul
from collections import Counter
import itertools


a = int(stdin.readline().rstrip())
b = int(a/500)
a -= b*500
c = int(a/5)
print(b*1000+c*5)

Submission status: Accepted

Solution code:
X = int(input())
c500, let = divmod(X, 500)
c5 , let = divmod(let, 5)
print(c500*1000 + c5*5)

Submission status: Accepted

Solution code:
X=int(input())

big=X//500
X=X%500
small=X//5

print(big*1000+small*5)

Submission status: Accepted

Solution code:
X = int(input())

goh = int(X/500)
goe = int((X-goh*500)/5)

print(goh*1000+goe*5)

Submission status: Accepted

Solution code:
n=int(input())

a=int(n/500)
n_=n-500*a
b=int(n_/5)
print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

answer=0

thousand=X//500
five=(X%500)//5

answer+=1000*thousand+5*five

print(answer)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)

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

Submission status: Accepted

Solution code:
X = int(input())

L = X//500
ans = L*1000
remain = X%500

l = remain//5
ans += l*5

print(ans)

Submission status: Accepted

Solution code:

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline
    n=int(readline())
    print((n//500)*1000 + ((n%500)//5)*5)
    #n,m,k=map(int, readline().rstrip().split())
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

x = ii()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	X = II()
	ans = 0
	ans += (X // 500)*1000
	X = X % 500
	ans += (X // 5)*5

	print(ans)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
def resolve():
    x = int(input())
    res = 0
    a, rest = divmod(x, 500)
    res += a * 1000
    a, rest = divmod(rest, 5)
    res += a * 5
    print(res)


resolve()

Submission status: Accepted

Solution code:
#n=int(input())
#a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
x=int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

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

    ans = 0 
    ans += (X // 500) * 1000

    X = X - (X // 500) * 500 

    ans += (X // 5) * 5

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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())
c = 0
if x >= 500:
    c += (x//500)*1000
    y = x%500
    c += (y//5)*5
else:
    c += (x//5)*5

print(c)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def Main(X):
    a, b = divmod(X, 500)
    c, d = divmod(b, 5)
    return a * 1000 + c * 5

def main():
    X = int(input())
    print(Main(X))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
X = int(stdin.readline().rstrip())

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ii = X // 500
jj = (X-ii*500) // 5

print(1000*ii+5*jj)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(a*1000 + b*5)

Submission status: Accepted

Solution code:

def main():
    x = int(input())
    gohyaku = x // 500
    x %= 500
    go = x // 5
    x %= 5
    print(gohyaku * 1000 + go * 5)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
from math import ceil,sqrt
def main():
    
    # for _ in range(ii()):
    
    # t=int(input())
    # n,m=map(int,input().split())
    # a=list(map(int,input().split()))
    
    
    
    
    
    n=int(input())
    x=n//500
    n%=500
    ans=1000*x
    x=n//5
    ans+=(5*x)
    print(ans)
    
    
    
    
    
    
    
    
    




    
if __name__ =="__main__":
    main()

Submission status: Accepted

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

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

result += a*1000 + b*5

print(result)

Submission status: Accepted

Solution code:
money = int(input())

hundred = int(money / 500)
five = int((money - (500 * hundred)) / 5)

print(hundred * 1000 + five * 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())

s = X // 500
X = X -(s*500)
t = X //5

print(1000*s + 5*t)

Submission status: Accepted

Solution code:
X = int(input())
n_500_cooins = X // 500
n_5_coins = (X % 500) // 5

print(n_500_cooins * 1000 + n_5_coins * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    m = int(input())
    num_500 = m // 500
    res = m % 500
    num_5 = res // 5
    print(num_500 * 1000 + num_5 * 5)



if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500

nokori = x - a * 500

b = nokori // 5

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
import sys
import os
from io import BytesIO, IOBase

#########################
# imgur.com/Pkt7iIf.png #
#########################

# returns the list of prime numbers less than or equal to n:
'''def sieve(n):
    if n < 2: return list()
    prime = [True for _ in range(n + 1)]
    p = 3
    while p * p <= n:
        if prime[p]:
            for i in range(p * 2, n + 1, p):
                prime[i] = False
        p += 2
    r = [2]
    for p in range(3, n + 1, 2):
        if prime[p]:
            r.append(p)
    return r'''

# returns all the divisors of a number n(takes an additional parameter start):
'''def divs(n, start=1):
    divisors = []
    for i in range(start, int(math.sqrt(n) + 1)):
        if n % i == 0:
            if n / i == i:
                divisors.append(i)
            else:
                divisors.extend([i, n // i])
    return divisors'''

# returns the number of factors of a given number if a primes list is given:
'''def divn(n, primes):
    divs_number = 1
    for i in primes:
        if n == 1:
            return divs_number
        t = 1
        while n % i == 0:
            t += 1
            n //= i
        divs_number *= t
    return divs_number'''

# returns the leftmost and rightmost positions of x in a given list d(if x isnot present then returns (-1,-1)):
'''def flin(d, x, default=-1):
    left = right = -1
    for i in range(len(d)):
        if d[i] == x:
            if left == -1: left = i
            right = i
    if left == -1:
        return (default, default)
    else:
        return (left, right)'''

# returns (b**p)%m 
'''def modpow(b,p,m):
    res=1
    b=b%m
    while(p):
        if p&1:
            res=(res*b)%m
        b=(b*b)%m
        p>>=1
    return res'''

# if m is a prime this can be used to determine (1//a)%m or modular multiplicative inverse of a number a
'''def mod_inv(a,m):
    return modpow(a,m-2,m)'''

# returns the ncr%m for (if m is a prime number) for very large n and r
'''def ncr(n,r,m):
    res=1
    if r==0:
        return 1
    if n-r<r:
        r=n-r
    p,k=1,1
    while(r):
        res=((res%m)*(((n%m)*mod_inv(r,m))%m))%m
        n-=1
        r-=1
    return res'''

# returns ncr%m (if m is a prime number and there should be a list fact which stores the factorial values upto n):
'''def ncrlis(n,r,m,fact):
    return (fact[n]*(mod_inv(fact[r],m)*mod_inv(fact[n-r],m))%m)%m'''

#count xor of numbers from 1 to n:
def xor1_n(n):
    d={0:n,1:1,2:n+1,3:0}
    return d[n&3]

def ceil(n, k): return n // k + (n % k != 0)
def ii(): return int(input())
def mi(): return map(int, input().split())
def li(): return list(map(int, input().split()))
def lcm(a, b): return abs(a * b) // math.gcd(a, b)
def prr(a, sep=' '): print(sep.join(map(str, a)))
def dd(): return collections.defaultdict(int)
def ddl(): return collections.defaultdict(list)
def ddd(): return collections.defaultdict(collections.defaultdict(int))
 

# region fastio
 
BUFSIZE = 8192
 
 
class FastIO(IOBase):
	newlines = 0
 
	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None
 
	def read(self):
			while True:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					if not b:
							break
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines = 0
			return self.buffer.read()
 
	def readline(self):
			while self.newlines == 0:
					b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
					self.newlines = b.count(b"\n") + (not b)
					ptr = self.buffer.tell()
					self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
			self.newlines -= 1
			return self.buffer.readline()
 
	def flush(self):
			if self.writable:
					os.write(self._fd, self.buffer.getvalue())
					self.buffer.truncate(0), self.buffer.seek(0)
 
 
class IOWrapper(IOBase):
	def __init__(self, file):
			self.buffer = FastIO(file)
			self.flush = self.buffer.flush
			self.writable = self.buffer.writable
			self.write = lambda s: self.buffer.write(s.encode("ascii"))
			self.read = lambda: self.buffer.read().decode("ascii")
			self.readline = lambda: self.buffer.readline().decode("ascii")
 

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#import collections
#from collections import deque
#import math
#import time
#import itertools
#import timeit
#import random
#from bisect import bisect_left as bl
#from bisect import bisect_right as br
#from bisect import insort_left as il
#from collections import OrderedDict

for _ in range(1):
    x=ii()
    res=x//500
    res*=1000
    res+=((x%500)//5)*5
    print(res)