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:
import sys
sys.setrecursionlimit(1 << 25)
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_tuple(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(tuple(map(int, read().split())))
    return ret


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols
    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])
    return ret


def read_matrix(H):
    '''
    H is number of rows
    '''
    ret = []
    for _ in range(H):
        ret.append(list(map(int, read().split())))
    return ret
    # return [list(map(int, read().split())) for _ in range(H)] # 内包表記はpypyでは遅いため


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_map_as_int(H):
    '''
    #→1,.→0として読み込む
    '''
    ret = []
    for _ in range(H):
        ret.append([1 if s == '#' else 0 for s in read()[:-1]])
        # 内包表記はpypyでは若干遅いことに注意
        # #numpy使うだろうからこれを残しておくけど
    return ret


MOD = 10**9 + 7
# default import
from collections import defaultdict, Counter, deque
from operator import itemgetter
from itertools import product, permutations, combinations
from bisect import bisect_left, bisect_right  # , insort_left, insort_right

X = read_a_int()
# なるべく500つぎに5
ans = (X // 500) * 1000
X = X % 500
ans += (X // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
money=int(input())
fh=money//500
nokori=money%500
five=nokori//5
ans=fh*1000+five*5
print(ans)

Submission status: Accepted

Solution code:
def golden(x):
    y = x//500
    z = (x-y*500)//5
    print(y*1000+z*5)

x = int(input())

golden(x)

Submission status: Accepted

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

while x // 500:
    happy += x // 500 * 1000
    x -= x // 500 * 500

while x // 5:
    happy += x // 5 * 5
    x -= x // 5 * 5

print(happy)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import floor

x = int(input())
count500 = floor(x / 500)
amari500 = x - 500 * count500
count5 = floor(amari500 / 5)
print(count500 * 1000 + count5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())
q, mod = divmod(n, 500)
q_5, mod_5 = divmod(mod, 5)
print((q * 1000) + (q_5 * 5))

Submission status: Accepted

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

tmp = x // 500
result += tmp * 1000
x -= tmp * 500

tmp = x // 5
result += tmp * 5
x -= tmp * 5

print(result)

Submission status: Accepted

Solution code:
# = map(int, input().split())
# = list(map(int, input().split()))
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

ans = y//5 * 5 + z * 1000
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
###########　入力
# 整数の入力
X = int(input())

point = 0

while X >= 500:
    X = X - 500
    point += 1000
while X >= 5:
    X = X - 5
    point += 5

###########　出力
print(point)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

N=int(readline())

hap=(N//500)*1000
N=N%500
hap+=(N//5)*5

print(hap)

Submission status: Accepted

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


def solve(X: int):
    gohyaku = X // 500
    nokori = X % 500
    go = nokori // 5
    print(1000*gohyaku + 5 * go)
    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 math
n=int(input())
t=(n//500)
s=((n-t*500)//5)*5
print(t*1000+s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

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

if __name__=='__main__':
  main()

Submission status: Accepted

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

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

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

x=int(input())

fh=math.floor(x/500)
x=x-fh*500
if x<5:
  print(fh*1000)
else:
  f=math.floor(x/5)
  print((fh*1000)+(f*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
n = int(input())

e1 = n // 500
n -= e1* 500

e2 = n // 5

ans = e1 * 1000 + e2 * 5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

gohyaku = x // 500
remain = x - gohyaku * 500
goen = remain // 5

print(int(gohyaku * 1000 + goen * 5))

Submission status: Accepted

Solution code:
N = int(input())

q_500, r_500 = divmod(N, 500)

q_5, r_5 = divmod(r_500, 5)

output = q_500 * 1000 + q_5 * 5

print(output)

Submission status: Accepted

Solution code:
X=int(input())
a500=X//500#500円の枚数
a5=(X-(500*a500))//5#5円の枚数
ans=a500*1000+a5*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def read():
    X = int(input())
    return X,

def exchange(x0, a):
    count = 0
    while True:
        x1 = x0 - a
        if x1 < 0:
            return x0, count
        count += 1
        x0 = x1
    return x0, count

def solve(X):
    x = X
    x, c500 = exchange(x, 500)
    x, c5 = exchange(x, 5)
    return 1000 * c500 + 5 * c5
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))

Submission status: Accepted

Solution code:
def main():
  n = int(input())
  #s = list(input())
  #s = input().split()
  #a,b = list(map(int,input().split()))
  #a = [input() for i in range(n)]
  #a = [int(input()) for i in range(n)]
  #a = [input().split() for i in range(n)]
  #a = [list(map(int,input().split())) for i in range(n)]
  ans = 0
  count = 0
  lis = []
  
  while n >= 5:
    if n >= 500:
      ans += 1000
      n -= 500
    elif n >= 5:
      ans += 5
      n -= 5
  print(ans)

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
x = int(input())

count_500 = 0
count_5 = 0
while x >= 500:
  x -= 500
  count_500 += 1

while x >= 5:
  x -= 5
  count_5 += 1
  
ans = 1000 * count_500 + 5 * count_5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(money):
  num_500 = money // 500
  num_5 = (money - num_500*500) // 5
  return 1000*num_500 + 5*num_5

if __name__ == "__main__":
  _x = int(input())
  print(int(solve(_x)))

Submission status: Accepted

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

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

import sys


def IOE():
    sys.stdin = open("input.txt", "r")
    sys.stdout = open("output.txt", "w")


def main():
    n = int(sys.stdin.readline())
    print((n//500)*1000+(((n-(n//500)*500))//5)*5)


if __name__ == "__main__":
    #IOE()
    main()

Submission status: Accepted

Solution code:
import sys
import numpy as np

from collections import deque 
from functools import reduce

# input = sys.stdin.readline

x = int(input())

m500 = x // 500
x %= 500
m5 = x // 5

print((m500*1000)+m5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    total = int(input())
    num_500 = total // 500
    num_5 = (total%500) // 5
    print(num_500*1000 + num_5*5)

Submission status: Accepted

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

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

    print(c500*1000 + c5*5)

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X = int(input())

q, r = divmod(X, 500)

v = 0

if q == 0:
    q, r = divmod(X, 5)
    v += 5 * q
else:
    v += 1000 * q
    q, r = divmod(r, 5)

    v += 5 * q

print(v)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

x, r = divmod(x, 500)

f = r // 5

print(x * 1000 + f * 5)

Submission status: Accepted

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


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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
x = int(input())
c1 = 0
c2 = 0

c1 = x // 500
x %= 500
c2 = x // 5

print(c1 * 1000 + c2 * 5)

Submission status: Accepted

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

n_500 = int(n / 500)

n_5 = int((n % 500) / 5)

print(n_500*1000+n_5*5)

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
a = x%500

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(1000*a+5*b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

def solve(N):
    a = int(N / 500) * 1000
    b = int(N % 500 / 5) * 5
    
    return a + b

print(solve(N))

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
while True:
    if x >= 500:
        x -= 500
        ans += 1000
    else:
        break

while True:
    if x >= 5:
        x -= 5
        ans += 5
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
s1, a = divmod(X, 500)
s2 = a // 5
print(s1*1000+s2*5)

Submission status: Accepted

Solution code:
import sys,math,copy,queue,itertools
from fractions import gcd
sys.setrecursionlimit(10**7)
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline())
INF = 10**18
MOD = 10**9 + 7
DD = ((1,0),(0,1),(-1,0),(0,-1))
x = NI()

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

Submission status: Accepted

Solution code:
X = int(input())
a = 0
b = 0
a = X//500
if a != 0:
    X %= 500*a

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(1000 * b + s * 5)

Submission status: Accepted

Solution code:
x = int(input())

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

print(a*1000 + b*5)

Submission status: Accepted

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

    five_hund = X // 500
    Q = X % 500
    five = Q // 5
    print(five_hund*1000 + five*5)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

X = int(input())

cnt_1000 = X // 500
extra = X % 500

cnt_5 = extra // 5

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

Submission status: Accepted

Solution code:
N = int(input())

# print(int(N/500))
ans = 0
ans += (int(N / 500)) * 1000
A = N % 500
# print(ans)

ans += int(A/5) * 5
print(ans)

Submission status: Accepted

Solution code:
inp = int(input())
fh = inp//500
f = (inp - 500*fh)//5

print(str(fh*1000+f*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(a*1000+b*5)

Submission status: Accepted

Solution code:
x = int(input())

gohyaku = x // 500
nokori = x - 500 * gohyaku
goen = nokori // 5

print(1000 * gohyaku + 5 * goen)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys,math
sys.setrecursionlimit(10**9)
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())


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

Submission status: Accepted

Solution code:
X = int(input())
if X<500:
    print(X//5*5)
else:
    h1 = X//500
    h2 = (X%500)//5
    print(h1*1000+h2*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

yen_500 = x // 500
yen = x % 500
yen_5 = yen // 5

print(yen_500 * 1000 + yen_5 *5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

m500 = X // 500

m5 = (X-m500*500)//5

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

Submission status: Accepted

Solution code:
X = int(input())

Large = X//500
Small = (X%500)//5

print(Large*1000 + Small*5)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import math
import itertools
import string
import queue
import copy
import time
from fractions import gcd

sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7


def inp(): return int(sys.stdin.readline())


def inp_list(): return list(map(int, sys.stdin.readline().split()))


def lcm(x, y): return (x * y) // gcd(x, y)


X = inp()

cnt_1000 = X // 500
X -= cnt_1000 * 500

cnt_5 = X // 5
print(1000 * cnt_1000 + 5 * cnt_5)

Submission status: Accepted

Solution code:
n = int(input())
#a,b = map(int,input().split())
#L = list(map(int,input().split()))
n1 = n//500
n2 = (n-n1*500)//5
#print(n1,n2)
print(n1*1000 + n2*5)

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

Submission status: Accepted

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

Submission status: Accepted

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

def main():
    x = int(input())
    hap = x // 500 * 1000
    x -= hap // 2
    hap += x // 5 * 5
    print(hap)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

#500円に優先両替
ans = 1000*int(X/500)
X -= 500*int(X/500)
ans += 5*int(X/5)
print(ans)

Submission status: Accepted

Solution code:
#整数の入力
N = int(input())

ans_500 = int(N/500)

ans_5 = N - (ans_500 * 500)
ans_5 = int(ans_5/5)

ans = ans_500*1000 + ans_5*5


print(ans)

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())
if X == 0:
  print(0)
else:
  total = int(X / 500)*1000+int((X%500)/5)*5
  print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
f = x //500
g = (x%500) //5

print(int(f*1000+g*5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'

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


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) // 5

print(1000*a + 5*b)

Submission status: Accepted

Solution code:
X = int(input())

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

p = X//500
q= (X%500)//5

print(p*1000+q*5)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    #s = input().rstrip().split(' ')
    s = int(input())
    hap = 0
    hap += int(s/500)*1000
    s -= int(s/500)*500
    hap += int(s/5)*5
    print(hap)

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

result = 0

result += int(X/500) * 1000
X -= int(X/500) * 500

result += int(X/5) * 5

print(result)

Submission status: Accepted

Solution code:
y = int(input())

a = 0

a += (y // 500)*1000

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

a+= (y // 5)*5

print(a)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

fh = x // 500

r = max(x - (fh*500),0)

f = r // 5

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(a+b)

Submission status: Accepted

Solution code:
X = int(input())

c500 = X//500
c5 = (X-c500*500)//5

print(c500*1000+c5*5)

Submission status: Accepted

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

import sys


def LI():
    return list(map(int, sys.stdin.buffer.readline().split()))


def I():
    return int(sys.stdin.buffer.readline())


def LS():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()


def S():
    return sys.stdin.buffer.readline().rstrip().decode('utf-8')


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


def SRL(n):
    return [list(S()) for i in range(n)]


def MSRL(n):
    return [[int(j) for j in list(S())] for i in range(n)]

# ----------------------------------------------------------------


def main():
    x = I()

    yen500 = x // 500
    yen5 = (x - 500 * yen500) // 5

    ans = yen500 * 1000 + yen5 * 5

    print(ans)


main()

Submission status: Accepted

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

if __name__ == '__main__':
    main()