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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
d,m=divmod(x,500)
ans+=d*1000
d,_=divmod(m,5)
ans+=d*5
print(ans)

Submission status: Accepted

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

MOD = 10**9
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

X = int(input())

go = X//500

ans = go*1000

nokori = (X - go*500)//5

ans += nokori*5

print(ans)

Submission status: Accepted

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

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

res = 0

tmp = X//500
res += tmp * 1000
X -= tmp * 500

tmp = X//5
res += tmp * 5

print(res)

Submission status: Accepted

Solution code:
import sys

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

X = ir()
hundred, remain = divmod(X, 500)
five = remain  // 5
answer = 1000 * hundred + 5 * five
print(answer)

Submission status: Accepted

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

X = int(input().split()[0])
t = 0
t += (X // 500) * 1000
t += ((X % 500) // 5) * 5
print(t)

Submission status: Accepted

Solution code:
from sys import stdin
def main():
    readline=stdin.readline
    x=int(readline())
    y=x//500
    print(y*1000+((x-y*500)//5)*5)
        
if __name__=="__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

n_500 = x // 500

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

print(n_500*1000+n_5*5)

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

num = X // 500
X -= 500 * num
ans += num * 1000

num = X // 5
ans += num * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

X = int(input())
ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])
    a = x//500
    b = (x-(500*a))//5

    return str(1000*a+5*b)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

yen_500 = x // 500
yen_50 = (x - yen_500 * 500) // 5
answer = yen_500*1000 + yen_50*5

print(answer)

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
b = X % 500


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

Submission status: Accepted

Solution code:
x = int(input())

amari = x % 500
gyaku = x // 500

go = amari // 5

print(gyaku*1000 + go*5)

Submission status: Accepted

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

print(a+b)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = int(input())

    five_hundred = x // 500
    fives = (x % 500) // 5

    print(five_hundred * 1000 + fives * 5)

Submission status: Accepted

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


def solve(X: int):
    Y = 0
    Y += 1000 * (X // 500)
    Y += 5 * ((X % 500) // 5)
    print(Y)
    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())
h1 = x//500*1000
h2 = (x%500)//5*5
print(h1+h2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#import sys
MOD = 10 ** 9 + 7
INFI = 10**10
#input = sys.stdin.readline
import math

import itertools

#import bisect

import copy
from functools import lru_cache

def sosuhante(n):
    for k in range(2, int(math.sqrt(n))+1):
        if n% k ==0:
            return False
    return True
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def kingaku(a,b,n):
    keta=len(str(n))
    return a*n+b*keta

def my_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default

#    h,w,a,b = map(int, input().split())
#    c = [[0 for j in range(n)] for i in range(n)]

def ret(a):
    c=[None]*(len(a)-1)
    if len(a)==1:
        return a[0]
    elif len(a)==0:
        return 0
    for i in range(1,len(a)):
        c[i-1]=abs(a[i]-a[i-1])
    return ret(c)


def main():
    n=int(input())
    go=n//500
    aaa=n-go*500
    go2=aaa//5
    print(1000*go+5*go2)




if __name__ == "__main__":

    main()

Submission status: Accepted

Solution code:
# coding: utf-8

X=int(input())

N=X//500

M=(X-N*500)//5

print(N*1000+M*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

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


main()

Submission status: Accepted

Solution code:
# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(l):
	n = len(l)
	

N = int(stdin.readline())
ans = 0
ans += 1000*(N//500)
mod = N%500
ans += 5*(mod//5)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7

# ここから書き始める
x = int(input())
ans = (x // 500) * 1000
x %= 500
ans += (x // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

numA = 0
numB = 0

if X >= 500:
    numA = X // 500
    X %= 500

if X >= 5:
    numB = X // 5
    X %= 5

print(1000 * numA + 5 * numB)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
#sys.setrecursionlimit(150000)


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


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
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:
n=int(input())
ans=0
ans+=(n//500)*1000
ans+=( (n-(n//500)*500) //5)*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

n = x // 500
m = x % 500

l = m // 5

print(n*1000 + l*5)

Submission status: Accepted

Solution code:
#def main(S, b):
if __name__ == '__main__':
    # n, m = map(int, input().split())
    n = int(input())

    a = n // 500

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

    print(a * 1000 + b * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def A():
    S = input()
    if S[2] == S[3] and S[4] == S[5]:
        print('Yes')
    else:
        print('No')

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

Submission status: Accepted

Solution code:
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
t=1
for tt in range(t):
    x=int(input())
    ans=(x//500)*1000
    x=(x%500)
    ans+=(x//5)*5
    print(ans)
    #n,k,s= map(int, sys.stdin.readline().split(' '))
    #a=list(map(int,sys.stdin.readline().split(' ')))
    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Submission status: Accepted

Solution code:
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):
    return [list(map(int,input().split()))for _ in range(n)]

x = iinp()

ans = 0

ans += (x//500)*1000

x = x%500

ans += (x//5)*5

x = x%5

print(ans)

Submission status: Accepted

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

gohyaku = math.floor(X/500)
go = math.floor((X - 500 * gohyaku)/5)

print(gohyaku * 1000 + go * 5)

Submission status: Accepted

Solution code:
x = int(input())
y = x // 500
z = (x-500*y) // 5
print(y*1000 + z*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:
import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline
x = int(input())
print((x // 500) * 1000 + ((x - (x // 500) * 500) // 5) * 5)

Submission status: Accepted

Solution code:
x = int(input())
a, b = divmod(x, 500)
c, d = divmod(b, 5)
print(1000 * a + 5 * c)

Submission status: Accepted

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

    y500 = x // 500
    y5 = (x - (y500*500)) // 5

    print(1000*y500+5*y5)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

n500 = x // 500

rest = x - n500 * 500

n5 = rest // 5

ans = n500 * 1000 + n5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

n500 = x // 500
n5 = (x%500 // 5)

answer = n500*1000+n5*5

print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

X=one_int()

big = X//500

X=X%500
sma = X//5

print(big*1000+sma*5)

Submission status: Accepted

Solution code:
X = int(input())
n_500, r = divmod(X, 500)
n_5, _ = divmod(r, 5)
print(n_500 * 1000 + n_5 * 5)

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

fhun = X // 500

amari = X % 500

five = amari // 5

print(fhun*1000 + five*5)

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
X -= a*500

b = X // 5

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]

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

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

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
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [int(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx():return list(map(lambda x:int(x)*-1,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))

if __name__ == "__main__":pass
x = i()
a = x//500
b = x%500
c = b//5
print(1000*a+5*c)

Submission status: Accepted

Solution code:
X = int(input())

C500, res =divmod( X,500)

print(C500*1000 + 5*(res //5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
a, b = divmod(X, 500)
ans = 1000*a
c, d = divmod(b, 5)
ans += 5 * c

print(ans)

Submission status: Accepted

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

print(A*1000+5*B)

Submission status: Accepted

Solution code:

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def rMap():
	return map(int,input().split())
def rList():
	return list(map(int,input().split()))
s = int(input())
print((s//500)*1000+5*((s%500)//5))

Submission status: Accepted

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

X = int(input())

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

ans = big * 1000 + small * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 500円硬貨で1000, 5円硬貨で5
X = int(input())
ans = 0
ans += (X // 500) * 1000
X %= 500
ans += (X // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
a = int(input())

result1 = (a // 500) * 1000
result2 = ((a % 500) // 5) * 5
print(int(result1 + result2))

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
from collections import Counter, defaultdict, deque

X, = [int(x) for x in input().split()]

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    x = int(input())

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

    print(ans)

Submission status: Accepted

Solution code:
x = int(input())
#)a= list(map(int,input().split()))

ans = 0

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

ans += (x // 5) * 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())
n500 = X//500
mod = X%500
n5 = mod//5

print(n500*1000 + n5*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:
n = int(input())

ans = n//500*1000

n = n -(n//500)*500

print(ans+(n//5)*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
N = int(input().strip())

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

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate
import sys
import bisect
import string
import math
import time


def I(): return int(input())


def S(): return input()


def MI(): return map(int, input().split())


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


def input(): return sys.stdin.readline().rstrip()


def show(*inp, end='\n'):
    if show_flg:
        print(*inp, end=end)


def print_matrix(mat):
    for i in range(len(mat)):
        print(*mat[i])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False
# show_flg = True


def main():
    X = I()
    a = X // 500
    b = (X % 500) // 5

    print(a * 1000 + b * 5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

a1 = int(n / 500)
b = n - a1 * 500

a2 = int(b / 5)

print(a1*1000 + a2*5)

Submission status: Accepted

Solution code:
originPrice = int(input())

glad = 0

glad += (originPrice // 500) * 1000
originPrice %= 500
glad += (originPrice // 5) * 5

print(glad)

Submission status: Accepted

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

ans = 0
a = n//500
ans += a*1000
n-=a*500
ans += n//5*5

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

Submission status: Accepted

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

X = int(input())

C500 = X//500
C5 = (X%500)//5

print(1000*C500+5*C5)

Submission status: Accepted

Solution code:
def main():
    X = int( input())
    print(X//500*1000 + X%500//5*5)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:


n = int(input())
ans = 0
while n-500>=0:
    ans += 1000
    n -= 500

while n-5>=0:
    ans += 5
    n -= 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = (x // 500) * 1000
x -= ans // 2

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


def exchange(x):
    num500, rest1 = divmod(x, 500)
    num5 = rest1 // 5
    return num500 * 1000 + num5 * 5


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


if __name__ == "__main__":
    main()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

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

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

rest = X - coin_500 * 500

coin_5 = rest // 5

print(coin_500 * 1000 + coin_5 * 5)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

x500 = x // 500
x -= x500 * 500
x5 = x // 5
x -= x5 * 5

print(x500 * 1000 + x5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
d,m = divmod(X,500)
ans = d*1000
d,m = divmod(X-d*500,5)
ans += d*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
coin_500 = X // 500
X -= 500 * coin_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 %= 500

ans += X // 5 * 5

print(ans)

Submission status: Accepted

Solution code:
import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
def resolve():
    X = ir()
    a = X//500
    b = (X-a*500)//5
    print(a*1000+b*5)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

x = int(input())

h1000 = x//500
x -= h1000*500

h5 = x//5

print(h1000*1000+h5*5)

Submission status: Accepted

Solution code:
x = int(input())

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

print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

x1 = x // 500
x1_ = x%500
x2 = x1_//5

print(x1*1000 + x2*5)

Submission status: Accepted

Solution code:
import math
import fractions
import bisect
import collections
import itertools
import heapq
import string
import sys
import copy
from decimal import *
from collections import deque
sys.setrecursionlimit(10**7)
MOD = 10**9+7
INF = float('inf') #無限大
def gcd(a,b):return fractions.gcd(a,b) #最大公約数
def lcm(a,b):return (a*b) // fractions.gcd(a,b) #最小公倍数
def iin(): return int(sys.stdin.readline()) #整数読み込み
def ifn(): return float(sys.stdin.readline()) #浮動小数点読み込み
def isn(): return sys.stdin.readline().split() #文字列読み込み
def imn(): return map(int, sys.stdin.readline().split()) #整数map取得
def imnn(): return map(lambda x:int(x)-1, sys.stdin.readline().split()) #整数-1map取得
def fmn(): return map(float, sys.stdin.readline().split()) #浮動小数点map取得
def iln(): return list(map(int, sys.stdin.readline().split())) #整数リスト取得
def iln_s(): return sorted(iln()) # 昇順の整数リスト取得
def iln_r(): return sorted(iln(), reverse=True) # 降順の整数リスト取得
def fln(): return list(map(float, sys.stdin.readline().split())) # 浮動小数点リスト取得
def join(l, s=''): return s.join(l) #リストを文字列に変換
def perm(l, n): return itertools.permutations(l, n) # 順列取得
def perm_count(n, r): return math.factorial(n) // math.factorial(n-r) # 順列の総数
def comb(l, n): return itertools.combinations(l, n) # 組み合わせ取得
def comb_count(n, r): return math.factorial(n) // (math.factorial(n-r) * math.factorial(r)) #組み合わせの総数
def two_distance(a, b, c, d): return ((c-a)**2 + (d-b)**2)**.5 # 2点間の距離
def m_add(a,b): return (a+b) % MOD
def print_list(l): print(*l, sep='\n')

def sieves_of_e(n):
    is_prime = [True] * (n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        if not is_prime[i]: continue
        for j in range(i * 2, n+1, i): is_prime[j] = False
    return is_prime

X = iin()

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

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

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

ans = 1000*a + 5*c

print(ans)

Submission status: Accepted

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

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

ans += 5 * (x // 5)

print(ans)

Submission status: Accepted

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

x = int(input())

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