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

while X - 500 >= 0:
    ans += 1000
    X -= 500
while X - 5 >= 0:
    ans += 5
    X -= 5

print(ans)

Submission status: Accepted

Solution code:
s = int(input())

happy = 0

n = int(s / 500)
happy += n * 1000
s = s - (n * 500)

n = int(s / 5)
happy += n * 5

print(happy)

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

k = (a//500)*1000
l = ((a%500)//5)*5

b = k + l

print(b)

Submission status: Accepted

Solution code:
N = int(input())
if N >= 500:
    t = N//500
    a = N%500
    if a >= 5:
        f = a//5
        print(1000*t+f*5)
    else:
        print(1000*t)
elif N >= 5:
    f = N//5
    print(f*5)
else:
    print("0")

Submission status: Accepted

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

#n = int(input())
#l = list(map(int, input().split()))

'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''
#import copy
#import numpy as np

x=int(input())
cnt=0
while x-500>=0:
    cnt += 1000*(x//500)
    x%=500
    #print(cnt,x)
while x-5>=0:
    cnt+= 5*(x//5)
    x %= 5
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())

n500 =n//500
n5 = (n - 500*n500)//5

print(1000*n500 + 5 * n5)

Submission status: Accepted

Solution code:
N=int(input())
a = N//500
ans1 = a*1000

b = N-(a*500)
b = b//5
ans2 = b*5
ans = ans1+ans2
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
if 0 <= X <= pow(10, 9):
    max500Coins = int(X/500)
    X = X % 500
    max5Coins = int(X/5)
    X = X % 5
    numberOFHappinessCoins = max500Coins*1000 + max5Coins*5
    print(numberOFHappinessCoins)

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())
u = 0
def a(x,u):
    if x>=500:
        u+=1000 * (x // 500)
        x = x % 500
        a(x,u)
    elif x>=5:
        u+=5 * (x // 5)
        x = x % 5
        a(x,u)
    else:
        print(u)
a(x,u)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
coin = int(input())

a = int(coin / 500) * 1000
remain = coin % 500
b = int(remain / 5) * 5

print(a + b)

Submission status: Accepted

Solution code:
#At coder 2020/3/27 B
# 整数の入力
a = int(input())

a2=a//500
a=a-a2*500
a3=a//5
ans=a2*1000+a3*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

q1 = x // 500
mod_500 = x % 500

q2 = mod_500 // 5
mod_5 = mod_500 % 5

print(q1*1000 + q2*5)

Submission status: Accepted

Solution code:
X = int(input())

i = 0

while X >= 500:
  X -= 500
  i += 1
  
a = 0
while X >= 5:
  X -= 5
  a += 1

ans = 1000*i + 5*a

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
A = X % 500
B = A % 5

Y = int(2 * (X - A))
Z = int(A - B)
print(Y + Z)

Submission status: Accepted

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

import math

x = int(input())

n500 = int(x / 500)
l500 = int(x % 500)

n5 = int(l500 / 5)

print(n500 * 1000 + n5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

gohyaku = (x//500)
answer = 0

if gohyaku > 0:
    x = x % 500
    answer += 1000 * gohyaku

goen = ( x // 5)

if goen > 0:
    answer += 5 * goen

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


x = 0

def format_input(filename = None):
	global x
	if filename == None:
		x = int(input())

	elif filename == '__random__':
		from random import randint as rng
		x = rng(0, 10**9)
		print(x)

def get_answer():
	num_of_500s = x // 500
	residue = x % 500
	num_of_5s = residue // 5

	answer = num_of_500s * 1000 + num_of_5s * 5

	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X=int(input())

A=X-X//500*500
B=A-A//100*100
C=B-B//50*50
D=C-C//10*10
E=D//5
app=X//500*1000 + E*5

F=A//5
maxi=X//500*1000 + F*5

print(max([app,maxi]))

Submission status: Accepted

Solution code:
x = int(input())

happy = 0
a = int(x/500)
happy = a*1000
a = int((x-(a*500))/5)
happy += a*5

print(happy)

Submission status: Accepted

Solution code:
from sys import stdin,stdout
Pi = lambda x: stdout.write(str(x) + '\n')
S = lambda x: x*(x+1) // 2
I = lambda x: 1+(2*x)
R = lambda:stdin.readline()
Ri = lambda x:map(int,x.split())
Rs = lambda x:map(str,x.split())
Rf = lambda x:map(float,x.split())
 
def main():	
	# t = int(R())
	for x in stdin:
		n = int(x)
		ans = (n//500)*1000
		n %= 500
		ans += (n//5)*5
		Pi(ans)



if __name__=='__main__':
	main()

Submission status: Accepted

Solution code:
x = int(input())


quotient = x // 500
remainder = x % 500

presure_1 = 1000 * quotient + (remainder // 5) * 5

presure_2 = (x // 5) * 5

if presure_1 >= presure_2:
  print(presure_1)
else:
  print(presure_2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
u = 0
while 500 <= X:
  X = X - 500
  u += 1000
while 5 <= X:
  X = X - 5
  u += 5
print(u)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

X = int(input())

# 500, 100, 50, 10, 5, 1
def main():
    def main0(x, acc):
        if x >= 500:
            acc += math.floor(x / 500) * 1000
            return main0(x % 500, acc) 
        # elif x >= 100:
        #     return main0(x % 100, acc) 
        # elif x >= 50:
        #     return main0(x % 50, acc) 
        # elif x >= 10:
        #     return main0(x % 10, acc) 
        elif x >= 5:
            acc += math.floor(x / 5) * 5
            return main0(x % 5, acc) 
        else:
            return acc

    return main0(X, 0)

print(main())

Submission status: Accepted

Solution code:
# 500円: 1000
# 5円: 5

X = int(input())

preasure = 0

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

print(int(preasure))

Submission status: Accepted

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

n = int(input())

n500 = int(n / 500)
# print(n500)
n5 = int(n-n500*500)
n5 = int(n5 / 5)

happy = n500 * 1000 + n5 * 5

print(happy)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


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


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

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

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:


s = int(input())

ans = 0

ans += (s // 500) * 1000

s = s % 500

ans += (s // 5) * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
pl = 0
 
q, mod = divmod(n, 500)
pl += q * 1000

q, mod = divmod(mod, 5)
pl += q * 5

print(pl)

Submission status: Accepted

Solution code:
X = int(input())
cnt_a = 0
cnt_b = 0

while X >= 500:
    cnt_a += 1
    X -= 500
while X >= 5:
    cnt_b += 1
    X -= 5

happiness = 1000 * cnt_a + 5 * cnt_b

print(happiness)

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

if X >= 500:
  gohyaku = X // 500
  nokori = X - (gohyaku * 500)
  go = nokori // 5

  uresi = (1000 * gohyaku) + (5 * go)

else:
  go = X // 5
  uresi = (5 * go)

print(uresi)

Submission status: Accepted

Solution code:
def main():
    #H , W = map(int, input().split())
    X = int(input())

    Sen = X // 500
    #print("%s" % Sen)
    XX = X - Sen * 500
    #print("%s" % XX)
    go = XX // 5

    print (str(Sen * 1000 + go * 5))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:

X=int(input())

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

tmp=X
total=0

result=[]

result.append(int(tmp/500))

tmp=tmp%500

result.append(int(tmp/5))

total+=result[0]*1000
total+=result[1]*5

print(total)

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,b = divmod(x,500)

c = b//5

print(a*1000+c*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
ans=0
a, y=divmod(x,500)
b, z=divmod(y,5)
ans=a*1000+b*5
print(ans)

Submission status: Accepted

Solution code:
s = input()
ss = int(s)

s_1000 = ss / 500
s_under = ss - 500*int(s_1000)
s_5 = int(s_under) / 5

s_sum = 1000*int(s_1000) + 5*int(s_5)

print(s_sum)

Submission status: Accepted

Solution code:
x = int(input())

K500 = x // 500

tmp = x - 500 * K500

K5 = tmp // 5

ans = 1000 * K500 + 5 * K5

print(ans)

Submission status: Accepted

Solution code:
s = int(input())

n1 = int(s / 500)
n1_re = int(s % 500)

n2 = int(n1_re / 5)

result = (n1 * 1000) + (n2 * 5)

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
k=X%500
f=X-k
s=f*2
d=k%5
s1=k-d
print(s+s1)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

print(a*1000+b*5)

Submission status: Accepted

Solution code:
x = int(input())

a=0
b=0
aper=0
if x!=0:
    a=x//500
    aper=x%500

if aper != 0:

    b= aper//5
    bper = aper%5

result = (a * 1000) + (b*5)

print(int(result))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
"""
"""


def int_as_array(num): return list(map(int, [y for y in str(num)]))


def array_as_int(arr): return int(''.join(map(str, arr)))


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


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


def array_to_string(arr, sep=' '): return sep.join(map(str, arr))


def matrix_to_string(arr, sep=' '): return '[\n' + '\n'.join(
    [sep.join(map(str, row)) for row in arr]) + '\n]'


coins = {
    500: 1000,
    100: 0,
    50: 0,
    10: 0,
    5: 5,
    1: 0
}


def solve(number):
    points = 0
    points += (number // 500) * 1000
    number = number % 500
    points += (number // 5) * 5
    number = number % 5
    return points


T = read_int()

print(solve(T))

Submission status: Accepted

Solution code:
from sys import stdin


def get_result(data):
    N = data[0]
    q, mod = divmod(N, 500)
    q_5, _ = divmod(mod, 5)
    return q * 1000 + q_5 * 5


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip('\n').split(' ')))
    result = get_result(data)
    print(result)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    x = II()
    ans = x // 500 * 1000
    ans += (x % 500) // 5 * 5
    print(ans)
    return


#main
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
input_value = input()
input_int = int(input_value)
division_500 = int(input_int / 500)
happiness_500 = division_500 * 1000
happiness_5 = int((input_int - division_500 * 500) / 5) * 5
print(happiness_500 + happiness_5)

Submission status: Accepted

Solution code:
A=int(input())

B=int(A/500)
ans1=int(B*1000)

C=int(A%500)
D=int(C/5)

ans2=int(D*5)

print(int(ans1+ans2))

Submission status: Accepted

Solution code:
x = int(input())

rest = x
ureshisa = 0

ureshisa += (rest // 500) * 1000
rest = rest % 500

ureshisa += (rest // 5) * 5

print(ureshisa)

Submission status: Accepted

Solution code:
x = input()
x = int(x)
co_500 = x // 500
amari_500 = x % 500
co_5 = amari_500 // 5
amari_5 = amari_500 % 5
co_1 = amari_5
print(1000*co_500 + 5*co_5)

Submission status: Accepted

Solution code:
X = int(input())

ans1 = X // 500

calc1 = X -(500*ans1)
ans2 = calc1 // 5

ans = ans1 *1000 + ans2 *5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

n500, amari = divmod(x, 500)
p = n500* 1000 + (amari//5)*5
print(p)

Submission status: Accepted

Solution code:
X = int(input())
x = X
L = []
for i in 500,100,50,10,5,1:
    a = x // i
    x -= i * a
    L.append(a)
for i in 100*L[1], 50*L[2], 10*L[3]:
    L[4] += i // 5
ans = 1000*L[0] + 5*L[4]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(five_handreds * 1000 + five * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
def main():
    arg = getInput(input())
    # arg = getInput(1024)
    ans = process(arg)
    print(ans)
    
def process(arg):
    yen500 = math.floor(arg / 500)
    amari = arg % 500
    yen5 = math.floor(amari / 5)
    ans = 1000 * yen500
    ans = ans + yen5 * 5

    return ans

def getInput(input):
    # 行数
    n = 1
    # 戻り値
    ret = None

    if n == 1:
        pass
        # ret = input
        # ret = list(input)
        ret = int(input)
        # ret = input.split()
        # ret = list(map(int, input.split()))
        # ret = input.split('T')
    else:
        for x in range(n):
            # 取得したい形式に変換
            ret = input[x]

    return ret

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#--------------------------------------------
#ライブラリ呼び出し
import sys
import math
#from math import sqrt
#--------------------------------------------
N = int(input())
ppp = N // 500
NN = N-500*ppp
pp = NN //5
ans = 1000*ppp+5*pp
print(ans)

Submission status: Accepted

Solution code:
# 入力の取得(文字列)
x = int(input())

five_hundred_yen = int(x/500)
five_yen = int((x-five_hundred_yen*500)/5)

print(five_hundred_yen*1000 + five_yen*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
count_five_hundred = int(X // 500)
count_five = int((X % 500) // 5)

max_happiness = count_five_hundred * 1000 + count_five * 5

print(max_happiness)

Submission status: Accepted

Solution code:
import math
inp = int(input())
add = math.floor(inp / 500) * 1000
add += math.floor((inp % 500) / 5) * 5
print(add)

Submission status: Accepted

Solution code:
X = int(input())

happy = 0

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

X += 500
happy -= 1000

while X>=0:
  X -= 5
  happy += 5
  
happy -= 5
  
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# 1行、1変数を受け取るとき
s = int(input())
print((int(s / 500) * 1000) + (int(s % 500 / 5) * 5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
readline=sys.stdin.buffer.readline
s=int(readline().rstrip())
print((s//500)*1000 + ((s%500)//5)*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

check1, mod = divmod(X, 500)
check2, mod = divmod(mod, 5)
ans = 1000 * check1 + 5 * check2
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

print(p)

Submission status: Accepted

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

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

en500 =0
amari = 0
en5 =0

kotae= divmod(kingaku,500)
en500 = int(kotae[0]) * 1000
amari = int(kotae[1])

kotae2= divmod(amari,5)
en5 = kotae2[0] *5

print(en500+en5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
happy = 0
while 500 <= money:
  money -= 500
  happy += 1000
while 5 <= money:
  money -= 5
  happy += 5
print(happy)

Submission status: Accepted

Solution code:
money_val = int(input())

if money_val < 5:
    print(0)
elif money_val < 500:
    print((money_val // 5)*5)
else:
    fivehun_num = (money_val // 500)
    five_num = money_val - (500*fivehun_num)
    five_num = five_num // 5
    print((fivehun_num*1000) + (five_num*5))

Submission status: Accepted

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

total = int(input())

a, mod = divmod(total, 500)
b = mod // 5

point = a*1000 + b*5

print(point)

Submission status: Accepted

Solution code:
input_money = int(input())

ureshisa = input_money//500 * 1000
input_money = input_money%500

if input_money > 0:
    ureshisa += input_money//5 * 5
    input_money = input_money%5

print(ureshisa)

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    a = N//500
    s = str(N)
    b = (N - a * 500) // 5

    return a*1000 + b*5

print(solve())

Submission status: Accepted

Solution code:
input_line = int(input())
Hcounter = 0
tmp = input_line

for i in range(input_line,499,-500):
  Hcounter+= 1000
  tmp -= 500

for j in range(tmp,4,-5):
  Hcounter+= 5

print(Hcounter)

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

happiness = 0

happiness += 1000 * (X // 500)
X -= 500 * (X // 500)
happiness += 5 * (X // 5)

print(happiness)

Submission status: Accepted

Solution code:
import math
x = int(input())
ans = 0
if math.floor(x/500) >=1 :
    ans += math.floor(x/500)*1000
    x -= math.floor(x/500)*500
if x > 0 and math.floor(x/5) >=1 :
    ans +=  math.floor(x/5)*5
print(ans)

Submission status: Accepted

Solution code:
a = int(input())

sho, ama = divmod(a,500)
sho2, ama2 = divmod(ama,5)

print( sho*1000+sho2*5 )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
X = sys.stdin.readline()
X = int(X)
score = (X//500) * 1000
X %= 500
score += (X//5) * 5
print(score)

Submission status: Accepted

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

ans += (x // 5) * 5
# ans -= 5 * (x // 5 )
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

x =int( x - (x%5))
y =int( x - (x%500))

z =int( y*2 + x%500)

print(z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

n1 = int(s / 500)
n1_re = int(s % 500)

n2 = int(n1_re / 5)

result = (n1 * 1000) + (n2 * 5)

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
s = int(input())
q, mod = divmod(s, 500)
q2, mod2 = divmod(mod, 5)
print(q*1000+q2*5)

Submission status: Accepted

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

print(1000*a + 5*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

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

Submission status: Accepted

Solution code:
x = int(input())
n_500yen = 0
n_5yen = 0

n_500yen = x // 500
amari = x % 500

n_5yen = amari // 5

presure = 1000 * n_500yen + 5 * n_5yen
print(presure)

Submission status: Accepted

Solution code:
input=input()
oq, omod = divmod(int(input), 500)
tq, tmod = divmod(int(omod), 5)
to=oq*1000
tt=tq*5
t=to+tt
print(t)

Submission status: Accepted

Solution code:
X = int(input())
dama500 = X // 500
dama5 = (X - dama500 * 500) // 5

print(dama500 * 1000 + dama5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
happy=0
#input=int('1000000000')
input=int(input())
happy500=(input//500) * 1000
change=input%500
happy5=(change//5) * 5
happy=happy500+happy5
print(happy)

Submission status: Accepted

Solution code:
s = int(input())
data = [500, 5, 100, 50, 10, 1]
ans = []
if s == 0:
    print(0)
    quit()
for i in range(len(data)):
    r = s // data[i]
    ans.append(r)
    s %= data[i]
print(ans[0]*1000 + ans[1]*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

if(x == 0):
    print(0)
else:
    x500 = (x // 500) * 1000
    x5 = ((x % 500) // 5) * 5
    print(x500 + x5)

Submission status: Accepted

Solution code:
c2u = {
    500: 1000,
    100: 0,
    50: 0,
    10: 0,
    5: 5,
    1: 0
}

X = int(input())

X0 = X
coin = {}
if X0 // 500 > 0:
    coin[500]  = X0 // 500
    X0 -= 500 * coin[500]
if X0 // 5 > 0:
    coin[5]  = X0 // 5
    X0 -= 5 * coin[5]
if X0 // 100 > 0:
    coin[100]  = X0 // 100
    X0 -= 100 * coin[100]
if X0 // 50 > 0:
    coin[50]  = X0 // 50
    X0 -= 50 * coin[50]
if X0 // 10 > 0:
    coin[10]  = X0 // 10
    X0 -= 10 * coin[10]
coin[1] = X0

u = 0
for k, v in coin.items():
    u += c2u[k] * v
print(u)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())


if a<500:
  a//=5
  a*=5
  print(a)
    
    
  
else:
  c=a//500
  d=c*500
  e=d*2
  a-=d
  a//=5
  a*=5
  print(a+e)

Submission status: Accepted

Solution code:
X=int(input())

if(X>=500):
    n=X//500
    point1=n*1000
    X=X-500*n
else:
    point1=0

d=X//5
point2=d*5

sum=point1+point2
print(sum)

Submission status: Accepted

Solution code:
data = int(input())


a = int(data / 500)
h = a * 1000

data = data - 500 * a

b = int(data / 5)
h += b * 5

print(h)