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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline

X = int(input())

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

print(1000*a + 5*b)

Submission status: Accepted

Solution code:
x = int(input())

y = x//500
x = x-(y*500)

z = x//5

print(y*1000+z*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

m  = x // 500

y = x - m*500

n = y // 5

print(m*1000 + n*5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(uresi)

Submission status: Accepted

Solution code:
#B
x = int(input())
total = 0
temp = x//500
total = total + (1000*temp)
x = x - (temp*500)
print(total+((x//5)*5))

Submission status: Accepted

Solution code:
X = int(input())

hund = X // 500

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

print(hund * 1000 + five * 5)

Submission status: Accepted

Solution code:
import sys

# S = input()
# N, M = map(int, input().split())
# nums = list(map(int, input().split()))
# nums_2d = [list(map(int, input().split())) for _ in range(N)]


def main():

    x = int(input())

    n500 = x//500

    rest = x - 500 * n500

    n5 = rest // 5

    happy = n500 * 1000 + n5 * 5

    print(happy)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:

x = int(input())
ans = 0
ans += (x // 500)*1000
if x % 500 != 0:
    ans += ((x%500)//5) * 5

print(ans)

Submission status: Accepted

Solution code:
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial
from bisect import bisect_left #bisect_left(list, value)
#from fractions import gcd
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 10**9+7
def input(): return sys.stdin.readline()[:-1]
def pri(x): print('\n'.join(map(str, x)))

X = int(input())

sen = X // 500
go = (X%500)//5

print(sen*1000 + go * 5)

Submission status: Accepted

Solution code:
#200
X = int(input())
happy = 0
gohyaku = X // 500
X1 = X - (500*gohyaku)
go = X1 // 5
happy = gohyaku * 1000 + go * 5
print(happy)

Submission status: Accepted

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

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

print(1000*a+5*b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(input())

ans = 0

fv = X // 500
ans += fv * 1000

X -= fv * 500

five = X // 5
ans += five * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    from builtins import int, map, list, print
    import sys
    sys.setrecursionlimit(10 ** 6)

    input = sys.stdin.readline
    input_list = (lambda: input().rstrip().split())
    input_number = (lambda: int(input()))
    input_number_list = (lambda: list(map(int, input_list())))

    N = input_number()
    ans = (N // 500)*1000
    N %= 500
    ans += (N // 5)*5
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
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:
import sys
readline = sys.stdin.readline

X = int(readline())

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

cnt = 0

while(x >= 500):
    cnt += 1000
    x = x-500

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

print(cnt)

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

Submission status: Accepted

Solution code:
from sys import stdin,setrecursionlimit
n = int(stdin.readline().rstrip())

point = 0

point += (n//500)*1000

n = n%500

point += (n//5)*5

print(point)

Submission status: Accepted

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n = inp()
    print(int((n//500)*1000+((n%500)//5)*5))
if __name__ == "__main__":
    main()

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:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(100000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)

def main(): #startline-------------------------------------------
    ans = 0
    x = int(input())
    while not(x < 500):
        ans += 1000
        x -= 500
    while not(x < 5):
        ans += 5
        x -= 5
    print(ans)
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():

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

if __name__ == '__main__':
    print(main())

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 = 0

ans += X//500*1000
X = X%500

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

q, mod = divmod(X, 500)

ans = q * 1000

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

Submission status: Accepted

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


def solve(X: int):
    c500 = X // 500
    rem = X - c500 * 500
    c5 = rem // 5
    print(1000*c500+c5*5)
    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:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

X = int(input())
_500 = X // 500
_5 = (X % 500) // 5
print(_500 * 1000 + _5 * 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())
d500, m = divmod(x, 500)
d5, m = divmod(m, 5)
print(d500 * 1000 + d5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
wubai = a // 500
a = a - 500 * wubai
wu = a //5

print(wubai * 1000 + wu * 5)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys

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

def main():
    q, r = divmod(x, 500)
    res = q * 1000
    q, r = divmod(r, 5)
    res += 5 * q
    print(res)

if __name__ == "__main__":
    main()

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
x-=a*500
b=x//5
print(a*1000+b*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:
import sys
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 li2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def dp2(ini, i, j): return [[ini]*i for i2 in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for i2 in range(j)] for i3 in range(k)]

X = ii()

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(1000*a+5*b)

Submission status: Accepted

Solution code:
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(read())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

X = int(input())
a = X // 500
rem = X - 500 * a
b = rem // 5

print(a * 1000 + 5 * 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())

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

print(sum_num)

Submission status: Accepted

Solution code:
x = int(input())
# list = [list(map(int,input().split())) for _ in range()]

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

print(num_500*1000 + num_5*5)

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ns = lambda: stdin.readline().rstrip()
ni = lambda: int(stdin.readline().rstrip())
nm = lambda: map(int, stdin.readline().split())
nl = lambda: list(map(int, stdin.readline().split()))

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
coin_500, amari = divmod(X,500)
coin_5, amari = divmod(amari, 5)

print(1000*coin_500 + 5*coin_5)

Submission status: Accepted

Solution code:
from sys import stdin, stdout 
from math import *
import itertools
import sys

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

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 * 1000
b = x % 500
c = b // 5 * 5

print(a+c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(ret)

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:
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X = int(read())
# なるべく 500
q, r = divmod(X, 500)
answer = 1000 * q + (r // 5) * 5
print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

c500 = x//500
x %= 500
c5 = x//5

print(1000*c500+5*c5)

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:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    ct=0
    ct+=(n//500)*1000
    n=n-(n//500)*500
    ct+=n//5*5
    print(ct)
if __name__ == '__main__':
    do()

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

go = x//500
x = x%500
f = x//5

print((go*1000)+(f*5))

Submission status: Accepted

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


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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
x = int(input())
ans = x // 500 * 1000
x %= 500
ans += x // 5 * 5
print(ans)

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:
import sys

def solve():
    X = int(input())
    L = (X // 500) * 1000
    X -= (X // 500) * 500
    L += (X // 5) * 5
    print(L)

    return 0

if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
x=int(input())
y=x//500
ans=y*1000
x=x-y*500
z=x//5
ans+=z*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
Y = X % 500

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

Submission status: Accepted

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

import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(0)
	n = int(sys.stdin.readline())
	happy = 0
	happy += n // 500 * 1000
	n %= 500
	happy += n // 5 * 5
	n %= 5
	print(happy)

	


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
c500=0
c5=0
while x>=500:
    c500+=1
    x-=500
while x>=5:
    c5+=1
    x-=5
print(c500*1000+c5*5)

Submission status: Accepted

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





if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())

five_h = x // 500
five = (x % 500) // 5

print(five_h * 1000 + five * 5)

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

x = int(input())

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

Submission status: Accepted

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

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:
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

x = int(input())

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

print(ans)

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

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

Submission status: Accepted

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

l = (x-r*500)//5

print(r*1000 + l*5)

Submission status: Accepted

Solution code:
X = int(input())

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

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

Submission status: Accepted

Solution code:
def examA():
    S = SI()
    if S[2]==S[3] and S[4]==S[5]:
        print("Yes")
    else:
        print("No")
    return

def examB():
    X = I()
    ans = 0
    ans += (X//500) * 1000
    X %= 500
    ans += (X//5) * 5
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**6)

if __name__ == '__main__':
    examB()

"""

"""

Submission status: Accepted

Solution code:
x = int(input())

ans, xxx = divmod(x, 500)
ans *= 1000
ans += (xxx//5) * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x=int(input())
u,v=divmod(x,500)
x,y=divmod(v,5)
print(1000*u+5*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:
x=int(input())
a=0
t=x//500
a+=t*1000
x=x-t*500
s=x//5
a+=s*5
print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def ri():
    return int(input())

def rl():
    return list(input().split())

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

def check(s):
    for i in range(len(s)):
        if s[i] != s[len(s)-1-i]:
            return False
    return True

def main():
    x = ri()
    h1 = x//500
    x -= h1*500
    h2 = x//5
    print(h1*1000+h2*5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
X = int(input())
a1 = int(X/500)
a2 = int((X % 500)/5)

print(a1*1000+a2*5)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

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

if __name__ == '__main__':
    main()

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

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

Submission status: Accepted

Solution code:
n = int(input())

a = n // 500
residue = n - 500 * a
b = residue // 5

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

Submission status: Accepted

Solution code:
#!usr/bin/env python3
import sys
import math
import string
import collections
import fractions
import random
from operator import itemgetter
import itertools
from collections import deque
import copy
import heapq
import bisect

MOD = 10 ** 9 + 7
INF = 10 ** 18
input = lambda: sys.stdin.readline().strip()

sys.setrecursionlimit(10 ** 8)

X = int(input())

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

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
from collections import deque

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

DR = [1, -1, 0, 0]
DC = [0, 0, 1, -1]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
     
def main():
    X = I()
    ans = 0
    ans += (1000 * (X // 500))
    X -= 500 * (X // 500)
    ans += (5 * (X // 5))
    print(ans)

main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

def main():
    N = int(input())
    
    ans = 0
    ans += (N//500)*1000
    rest = N%500
    ans += (rest//5)*5
    
    print(ans)    
    
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())


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