Problem:


Score : 200 points

Problem Statement

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

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

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

Constraints

0 \leq X \leq 10^9

X is an integer.

Input

Input is given from Standard Input in the following format:

X

Output

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

Sample Input 1

1024

Sample Output 1

2020

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

Sample Input 2

0

Sample Output 2

0

He is penniless - or yenless.

Sample Input 3

1000000000

Sample Output 3

2000000000

He is a billionaire - in yen.



Sample input:
1024


Sample output:
2020

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
while X >= 5:
  if X >= 500:
    ans += 1000
    X -= 500
  elif X >= 5:
    ans += 5
    X -= 5
    
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

happy = 0

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

print(happy)

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

gohyaku = n // 500
go = (n-(gohyaku*500))//5

print(gohyaku*1000 + go*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8
x = int(input())
ans, tmp = divmod(x, 500)
ans *= 2 * 500
ans += (tmp // 5) * 5
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


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


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(X):
    ans = 0
    ans += (X // 500) * 1000
    X %= 500
    ans += (X // 5) * 5
    return ans


def main():
    X = read_int()
    print(slv(X))


if __name__ == '__main__':
    main()

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())
q, mod = divmod(X, 500)
print(1000 * q + 5 * (mod // 5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#%%
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

a = (x//500)

x -= a*500

b = (x//5)

ans = a*1000 + b*5

print(ans)

Submission status: Accepted

Solution code:
N=int(input())

a=int(N//500)

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

print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

five_hundred = X // 500
rest = X - 500 * five_hundred
five = rest // 5

ans = 1000 * five_hundred + 5 * five
print(ans)

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

Y = X//500
Z = (X%500)//5
print(int(1000*Y+5*Z))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
X = int(input())
hyaku = X // 500
amari = X % 500
go = amari // 5

print(hyaku * 1000 + go * 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:
x = int(input())

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

print(1000*a + 5*c)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x = int(input())
d1, m = divmod(x, 500)
d2, _ = divmod(m, 5)

ans = d1 * 1000 + d2 * 5
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 20:51:25 2020

@author: naoki
"""

X = int(input())

A = X // 500
remain = X % 500

B = remain // 5

print(A*1000 + B*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500
b = X - 500*a
c = b//5
ans = 1000*a + c*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 calc(X):
    a = X // 500
    b = (X - 500 * a) // 5
    return a * 1000 + b * 5

X = int(input())
print(calc(X))

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


X = I()

ans = 0
ans += (X // 500) * 1000
X -= (X // 500) * 500
ans += (X // 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:
# -*- coding: utf-8 -*-

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

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

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

total = 0

n = X // 500
total += n * 1000
X -= n * 500

n = X // 5
total += n * 5
X -= n * 5

print(total)

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())
a=X//500
b=(X-a*500)//5

print(a*1000+5*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3.4
# -*- coding: utf-8 -*-
# abc160/abc160_b
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    a = N // 500
    b = N % 500 // 5
    print(a * 1000 + b * 5)
    return

main()

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:
def main ():
    x = int(input())
    n = x//500
    m = (x-n*500)//5
    ans = 1000*n + 5*m
    print(ans)




    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = int(input())

co_500=a//500
a-=co_500*500
co_5=a//5
print(co_500*1000+co_5*5)

Submission status: Accepted

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

    ans = X // 500 * 1000

    X = X % 500

    ans += X // 5 * 5

    print(ans)


resolve()

Submission status: Accepted

Solution code:
s=int(input())

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

Submission status: Accepted

Solution code:
import bisect
import math
from collections import deque

def sRaw():
    return input().rstrip("\r")


def iRaw():
    return int(input())


def ssRaw():
    return input().split()


def isRaw():
    return list(map(int, ssRaw()))

INF = 1 << 29



def main():
    X = iRaw()
    d500 = X//500
    d5 = (X%500)//5
    return d500*1000+d5*5

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from functools import reduce
from operator import mul
sys.setrecursionlimit(10**6)

def InMap(): return list(map(int, sys.stdin.readline().split(' ')))
def In(): return int(sys.stdin.readline())
def InS(): return sys.stdin.readline()

X = In()
M = X // 500
X -= 500 * M
D = X // 5
print((M*1000)+(D*5))

Submission status: Accepted

Solution code:
X = int(input())

fivehundred = X//500

remaining = X%500

five = remaining//5

print(fivehundred*1000 + five*5)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10 ** 6)  # 再帰関数の再帰の深さを設定
to_index = lambda x: int(x) - 1  # 入力した数字に1を引いたものを返す
print_list_in_2D = lambda x: print(*x, sep="\n")  # リストの要素を改行を挟んで表示する関数

# 入力を整数に変換して受け取る
def input_int():
    return int(input())

def map_int_input():
    return map(int, input())

MII = map_int_input

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

def MII_to_index():
    return map(to_index, input())

def MII_split_to_index():
    return map(to_index, input().split())

# 入力全てを整数に変換したものの配列を受け取る
def list_int_inputs():
    return list(map(int, input()))

LII = list_int_inputs

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

# 2次元リスト化
def LII_2D(rows_number):
    return [LII() for _ in range(rows_number)]

def LII_split_2D(rows_number):
    return [LII_split() for _ in range(rows_number)]

X = input_int()

joy = 0
while X >= 500:
    X -= 500
    joy += 1000

while X >= 5:
    X -= 5
    joy += 5

print(joy)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x = int(input())
u = (x // 500) * 1000
x %= 500
u += (x // 5) * 5

print(u)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x=int(input())

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

print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

#print(*ans, sep='\n')

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

z = x // 5
ans += z * 5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
c500, m = divmod(x, 500)
c5, m2 = divmod(m, 5)

print(c500*1000 + c5*5)

Submission status: Accepted

Solution code:
# /usr/bin/python3
# -*- coding: utf-8 -*-
from queue import Queue
from queue import LifoQueue as Stack
from math import sqrt, floor, ceil, log2
from fractions import gcd
from itertools import permutations, combinations
from operator import itemgetter
from functools import cmp_to_key



__MOD__=(10**9)+7
yn = 'YNeos'
judge = False
cnt = 0
ans = None


def lcm(a, b):
    return (a*b) // gcd(a,b)

def intinput():
    return int(input())

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

def lineinputs(func=intinput):
    datas = []
    while True:
        try:
            datas.append(func())
        except EOFError:
            break
    return datas

class ModInt():
    def __init__(self, x):
        self.__x = (x % __MOD__)
    def __add__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x + other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x + other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __sub__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x - other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x - other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __mul__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__x)%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__x)%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __truediv__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__((self.__x * other.__modinv())%__MOD__))
        elif type(other) == ModInt:
            return self.__class__((self.__x * other.__modinv())%__MOD__)
        else:
            raise Exception("Not Int or Not ModInt")
    def __pow__(self, other):
        if type(other) == int:
            other = self.__class__(other)
            return int(self.__class__(pow(self.__x, other.__x, __MOD__)))
        elif type(other) == ModInt:
            return self.__class__(pow(self.__x, other.__x, __MOD__))
        else:
            raise Exception("Not Int or Not ModInt")
    def __modinv(self, m=__MOD__):
        a = self.__x
        if a == 0:
            raise ZeroDivisionError()
        if gcd(a, m) != 1:
            raise Exception("%sの逆数は求まりません。" % a)
        b, u, v = m, 1, 0
        while b != 0:
            t = a//b;
            a -= t*b
            a, b = b, a
            u -= t * v
            u, v = v, u
        u %= m
        if u < 0:
            u += m
        return u
    def __int__(self):
        return self.__x



if __name__ == '__main__':
    X = intinput()

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(h)

Submission status: Accepted

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

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
s = int(input())

ans = 0

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

ans += (s//5)*5

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

result = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!python3

iim = lambda: map(int, input().rstrip().split())

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

    a, b = divmod(X, 500)
    ans = a * 1000
    a, b = divmod(b, 5)
    ans += a * 5
    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())                                          # 1行1列

sum = 0
sum += int(N/500)*1000
sum += int((N%500)/5)*5

print(sum)

Submission status: Accepted

Solution code:
#gcdは3.4.3だとfractionsにある
from fractions import gcd
import math

from math import factorial as f

from math import ceil,floor,sqrt


import bisect
import re
import heapq


from copy import deepcopy
import itertools

from sys import exit

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

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

num_500 = X/500
remain = X%500

num_5 = remain/5

print num_500*1000 + num_5*5

Submission status: Accepted

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

Submission status: Accepted

Solution code:



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

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


if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import sys
import math

from collections import defaultdict
from collections import deque
def load(vtype=int):
    return vtype(input().strip())
def load_list(seplator=" ", vtype=int):
    return [vtype(v) for v in input().strip().split(seplator)]
def exit():
    import sys
    sys.exit(0)
def perm_sub(li, used):
    if len(li) == len(used):
        return [deque()]
    k = []
    for i in range(len(li)):
        if i in used:
            continue
        used.add(i)
        sub_list = perm_sub(li, used)
        for sub in sub_list:
            sub.appendleft(li[i])
        k.extend(sub_list)
        used.discard(i)
    return k
def perm_li(li):
    return perm_sub(li, set())
def perm_n(n):
    return perm_sub(list(range(n)), set())
def join_i(li, sep=""):
    return sep.join([str(e) for e in li])
def li2n(li):
    n, base = 0, 1
    for i in range(len(li)-1, -1, -1):
        n += li[i] * base
        base *= 10
    return n
def sli2ili(li):
    return [int(s) for s in li] 
def prime_list(n):
    li = [i for i in range(2, n+1)]
    for i in range(len(li)):
        if li[i] >= int(math.sqrt(n)):
            break
        if li[i] == -1:
            continue
        for j in range(i+1, len(li)):
            if li[j] % li[i] == 0:
                li[j] = -1
    return [n for n in li if n != -1]
def gcd(a, b):
    a, b = max(a, b), min(a, b)
    while True:
        r = a % b
        if r == 0: return b
        a, b = b, r
def lcm(a, b):
    return int(a * b / gcd(a,b))
def all_subset(li):
    s = []
    n = len(li)
    for bit in range(0, (1<<(n+1))):
        ss = set()
        for i in range(0, n):
            if (bit & (1 << i)):
                ss.add(li[i])
        s.append(ss)
    return s
def factorial(n):
    if n == 1:
        return 1
    return n * factorial(n-1)
def mCn(m, n):
    def factorial_ntimes(m, n):
        r = 1
        while n:
            r *= m
            m -= 1
            n -= 1
        return r
    return int(factorial_ntimes(m, n) / factorial(n))


x = load()

c500 = 0
c5 = 0

while x >= 500:
    x -= 500
    c500 += 1

while x >= 5:
    x -= 5
    c5 += 1


print(c500 * 1000 + c5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

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

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

    print(ans)

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
a = int(input())

b = a // 500
cha = a % 500
c = cha // 5
d = 1000 * b + c * 5
print(d)

Submission status: Accepted

Solution code:
import math
import copy
from copy import deepcopy
import sys
import fractions
# import numpy as np
from functools import reduce
# import statistics
import decimal
import heapq
import collections
import itertools
from operator import mul

sys.setrecursionlimit(100001)


# input = sys.stdin.readline
# sys.setrecursionlimit(10**6)

# ===FUNCTION===

def getInputInt():
    inputNum = int(input())
    return inputNum


def getInputListInt():
    outputData = []
    inputData = input().split()
    outputData = [int(n) for n in inputData]

    return outputData


def getSomeInputInt(n):
    outputDataList = []
    for i in range(n):
        inputData = int(input())
        outputDataList.append(inputData)

    return outputDataList


def getSomeInputListInt(n):
    inputDataList = []
    outputDataList = []
    for i in range(n):
        inputData = input().split()
        inputDataList = [int(n) for n in inputData]
        outputDataList.append(inputDataList)

    return outputDataList


# ===CODE===

x = int(input())

ans = 0

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

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools

x = int(input())

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

Submission status: Accepted

Solution code:
X=int(input())

gohyaku=X//500
res=X-(gohyaku*500)
goen=res//5
print((gohyaku*1000)+(goen*5))

Submission status: Accepted

Solution code:
X = int(input())

# 500
n_500 = X // 500
X -= 500 * n_500

# 5
n_5 = X // 5
X -= 5 * n_5

print(1000 * n_500 + 5 * n_5)

Submission status: Accepted

Solution code:
def main():
    import sys
    input = sys.stdin.readline

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

X = INT()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

x = INT()

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans += 5*(x // 5)

print(ans)

Submission status: Accepted

Solution code:
X=int(input())

gohyaku = X // 500
X = X % 500

go = X // 5
X = X % 5

print(gohyaku*1000 + go * 5)

Submission status: Accepted

Solution code:
x = int(input())

gohyaku = x // 500
nokori = x % 500
go = nokori // 5
print(gohyaku*1000 + go * 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:
import sys

x = int(input())

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

#print(x, a)
print(a * 1000 + c * 5)

Submission status: Accepted

Solution code:
x = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
# 500円をできるだけ多く残りを5円にする。
n500 = x // 500
left = x - 500 * (x//500)
n5 = left // 5
print(n500*1000+n5*5)

Submission status: Accepted

Solution code:
import string
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

X = num()
bc = X // 500
sc = (X - (bc*500)) // 5
print( bc * 1000 + sc * 5)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

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

def print_l(l):
    print(' '.join(map(str, l)))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

x = n_in()

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

Submission status: Accepted

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

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
import numpy

x = int(input())

e = int(x / 500)
f = int((x - 500*e) / 5 )

print(e*1000 + f * 5)

Submission status: Accepted

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

x = int(input())
memo = math.floor(x / 500)
ans = memo * 1000 + math.floor((x - memo * 500) / 5) * 5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

s = x//500
t = x%500
k = t//5

print(int(s*1000+k*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

n = X // 500
m = X % 500 // 5

print(1000 * n + 5 * m)

Submission status: Accepted

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

Submission status: Accepted

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

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:
def II():return int(input())
def MI():return map(int,input().split())
def LI():return list(MI())
def ok():print("Yes")
def ng():print("No");exit()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import sys
INF = 10 ** 11
MOD = 10 ** 9 + 7
from collections import deque
sys.setrecursionlimit(100000000)
from heapq import heapify,heappush,heappop   

def main():
    x = int(input())
    a = x//500
    x -= a * 500
    b = 0
    if x > 0:
        b += x//5
    ans = 1000 * a + 5 * b
    print(ans)

if __name__=='__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
# 500円
q1, r = divmod(x, 500)
# 5円
q2 = r // 5
print(q1 * 1000 + q2 * 5)