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

Submission status: Accepted

Solution code:
X = int(input())

n500 = X // 500
r = X - (n500 * 500)
n5 = r // 5

print(n500 * 1000 + n5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

ans = 1000*fh+5*five

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

X_500 = X // 500

X_5 = (X- (X_500 * 500))//5

print(X_500*1000 + X_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())
a = X // 500 # 500円硬貨の枚数
b = (X - 500 * a) // 5
happy = a * 1000 + b * 5
print(str(happy))

Submission status: Accepted

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


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


# 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
    print(solve(X))

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
ans = 0
for i in [500, 5]:
    m = x // i
    x -= m * i
    if i == 500:
        ans += 1000 * m
    if i == 5:
        ans += 5 * m
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

N_500 = X // 500
mod_x = X - 500 * N_500
N_5 = mod_x // 5

ans = N_500 * 1000 + N_5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

a = n // 500
n = n % 500
b = n // 5

print(a * 1000 + b * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

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

if __name__ == '__main__':
  main()

Submission status: Accepted

Solution code:
R = 0
inp = int(input())
D = divmod(inp,500)
R += D[0] *1000
D = divmod(D[1],5)
R += D[0] *5
print(R)

Submission status: Accepted

Solution code:
x = int(input())

n1 = x//500

n2 = (x%500)//5

print(n1*1000+n2*5)

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500 * 1000
b = 0
if X % 500 != 0:
    b = (X % 500) // 5 * 5
print(a + b)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

score = 0
while(X >= 500):
    X -= 500
    score += 1000

while(X >= 5):
    X -= 5
    score += 5
print(score)

Submission status: Accepted

Solution code:
x=int(input())
fh, mod = divmod(x, 500)
f = mod // 5
ans = fh * 1000 + f * 5
print(ans)

Submission status: Accepted

Solution code:
import math
from collections import defaultdict
ml=lambda:map(int,input().split())
ll=lambda:list(map(int,input().split()))
ii=lambda:int(input())
ip=lambda:input()

"""========main code==============="""

t=ii()
ans=0
k=t//500
ans+=(k*1000)
t-=(k*500)
#print(t)
p=t//5
ans+=p*5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(ok)

Submission status: Accepted

Solution code:
X = int(input())
if X%500 == 0:
  print((X//500*1000))
else:
  Gohyaku = X//500
  X -= 500*(Gohyaku)
  Five = X//5
  print(Gohyaku*1000+Five*5)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n=int(input())
a = n//500
b = n%500
b = b//5
print(a*1000+b*5)

Submission status: Accepted

Solution code:
x=int(input())

fh=x//500
hy=(x-(500*fh))//5

print(fh*1000+hy*5)

Submission status: Accepted

Solution code:
import math
x = int(input())
thousand = math.floor(x/500)

y = x - 500*thousand

five = math.floor(y/5)

ans = 1000*thousand + 5 * five

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())

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

Submission status: Accepted

Solution code:

x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import Counter

n = int(sys.stdin.readline().strip())
print(n // 500 * 1000 + (n % 500) // 5 * 5)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

H = X //500
mod = X % 500

F = mod // 5

print(H*1000 + F*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Sat Mar 28 11:53:27 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

x = ni()
ans = 0

while x:
    if x // 500 == 0:
        ans += x // 5 * 5
        break
    else:
        ans += x // 500 * 1000
        x %= 500

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

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


s -= (s//500)*500

ans += (s//5)*5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

happy_1 = X//500 * 1000 #500硬貨の数
happy_rest = (X % 500) // 5
happy_2 = happy_rest * 5

print(happy_1+ happy_2)

Submission status: Accepted

Solution code:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  x=I()

  ans=0
  while True:
    if x//500>0:
      ans+=(x//500)*1000
      x=x%500
    else:
      ans+=(x//5)*5
      return ans

# main()
print(main())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

y500 = int(x/500)
y5 = int((x % 500)/5)

print(y500*1000+y5*5)

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

tmp = X // 5
ans += tmp * 5
X -= 5 * tmp

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

print(ans)

Submission status: Accepted

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

if X >= 500:
    a = X//500
    total += 1000 * a
    X -= 500 * a
if X >= 5:
    b = X//5
    total += 5 * b

print(total)

Submission status: Accepted

Solution code:
X = int(input())

l = [500, 5]
ans = 0
ans += (X // 500) * 1000
X = X % 500
ans += (X // 5) * 5 
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

s = int(input())

a = s // 500
b = s % 500

c = b // 5

ans = a * 1000 + c * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
a = x // 500
y = x % 500

b = y // 5

print(a*1000 + b*5)

Submission status: Accepted

Solution code:
import sys
import math
import collections
from collections import deque
x = int(input())
#n, s = map(int, sys.stdin.readline().split())
#s = input()
#a = list(map(int, sys.stdin.readline().split()))

a = math.floor(x/500)
b = x % 500
c = math.floor(b/5)

print(1000*a + 5*c)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

def main():

    input = stdin.readline

    X = int(input())

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

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

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

# import numpy as np
# import scipy as scp

# strlist = "abcdefghijklmnopqrstuvwxyz"
x = int(input())

jpy500 = 0
jpy5 = 0

jpy500 = x//500
x -= 500*jpy500
jpy5 = x//5

ans = jpy500*1000 + jpy5*5
print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する

Submission status: Accepted

Solution code:
X = int(input())

v500 = 0
v5 = 0

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

if X >= 5:
    v5 = X // 5
    
print(v500*1000 + v5*5)

Submission status: Accepted

Solution code:
inp = int(input())

n_500 = inp // 500
happy_500 = 1000 * n_500

res = inp - n_500 * 500
n_5 = res // 5
happy_5 = 5 * n_5

print(happy_5 + happy_500)

Submission status: Accepted

Solution code:
from sys import stdin
n = int(input())
k = n // 500
n = n- k*500
t = n // 5
print(1000*k + 5 * t)

Submission status: Accepted

Solution code:
n=int(input())
a=n//500
b=(n-500*a)//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())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
x = int(input())

q1, r1 = divmod(x, 500)
q2, r2 = divmod(r1, 5)

ans = q1 * 1000 + q2 * 5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# print('input >>')
X = int(input())

happiness = 0

gohyaku = X // 500
happiness += gohyaku * 1000
X -= 500 * gohyaku
go = X // 5
happiness += go * 5

# print('-----output-----')
print(happiness)

Submission status: Accepted

Solution code:
import sys
import math
import bisect

def solve(n):
    ans = n // 500 * 1000
    n %= 500
    ans += n // 5 * 5
    return ans

def main():
    n = int(input())
    print(solve(n))

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

coin = [500, 5,1]
num = []

for ic in coin:
    num.append(X//ic)
    X = X%ic

    
print(1000 * num[0] + 5 * num[1])

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
# a,b = map(int,input().split())
# A = list(map(int,input().split()))
# An = [list(map(int,input().split())) for i in range(n)]
a = n//500
b = (n-a*500)//5
ans = int(a*1000 + b*5)
print(ans)

Submission status: Accepted

Solution code:
import sys
X=input()
MONEY=int(X)
BIG=MONEY//500
left=MONEY%500
SMALL=left//5
print(BIG*1000+SMALL*5)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
num500 = X//500
num5 = (X-500*num500)//5

print(num500*1000+num5*5)

Submission status: Accepted

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

    count = 0

    num1 = a // 500
    num2 = a % 500
    count = num1 * 1000
    num3 = num2 // 5
    count = count + num3* 5

    print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

over_fh = x // 500

under_fh = x % 500

ans = over_fh * 1000 + (under_fh // 5) * 5

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
x = int(input())

c_500 = x//500

tmp = x%500

c_5 = tmp//5

print(1000*c_500+5*c_5)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 28 21:03:36 2020

@author: Kanaru Sato
"""

x = int(input())

countone = 0
counttwo = 0

while x >= 500:
    x = x-500
    countone += 1
while x >= 5:
    x = x-5
    counttwo += 1

ans = countone*1000 + counttwo*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:
# B

X = int(input())

q1, mod1 = divmod(X, 500)
q2, mod2 = divmod(mod1, 5)
print(1000*q1 + 5*q2)

Submission status: Accepted

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

@author: H_Hoshigi
"""

X = int(input())

n_500 = X//500
n_5 = (X%500)//5

print(n_500*1000 + n_5*5)

Submission status: Accepted

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

# output
print((X//500)*1000 + (X%500//5)*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:
X = int(input())
d, m = divmod(X, 500)
ans = d * 1000 + 5 * (m // 5)
print(ans)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    b_1 = X // 500
    b_2 = (X % 500) // 5
    print("{}".format(b_1*1000 + b_2*5))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
x = int(input())
n500 = x // 500
r500 = x % 500
n5 = r500 // 5

print(n500 * 1000 + n5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

happy = 0
n500 = X // 500
happy += n500*1000
X -= n500*500
happy += (X // 5)*5

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

sum = (n//500)*1000
m = n % 500

sum += (m//5)*5

print(sum)

Submission status: Accepted

Solution code:
x = int(input())

h_500 = x//500*1000
h_5 = (x%500)//5*5

print(h_500+h_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

d, m = divmod(x, 500)
ans = d * 1000

d, m = divmod(m, 5)
ans += d * 5
print(ans)

Submission status: Accepted

Solution code:
from collections import deque
import heapq
import itertools
import math

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#


def main():
    t = int(input())
    gohyaku = t // 500
    remain = t - gohyaku * 500
    goen = 0
    if remain > 0:
        goen = remain // 5
    print(gohyaku * 1000 + goen * 5)


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:
# Code for B - Golden Coins
# Use input() to fetch data from STDIN
from math import floor

x = int(input())

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

c = floor(b / 5)

print(a * 1000 + c * 5)

Submission status: Accepted

Solution code:
#abc.py
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:
from sys import stdin
#N, M, C = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

a=0
b=0

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

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

Submission status: Accepted

Solution code:
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

Submission status: Accepted

Solution code:
y = int(input())

gohyaku = y//500
y -= gohyaku*500

goen = y//5

print(gohyaku * 1000 + goen * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

n = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(k*1000 + z* 5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

u1 = int(x / 500)
u2 = int((x - u1*500) / 5)

print(u1*1000 + u2*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

f_hund = x // 500
amari = x - f_hund * 500
f_en = amari // 5

print(f_en * 5 + f_hund * 1000)

Submission status: Accepted

Solution code:
X = int(input())

happy = 0
q, m = divmod(X, 500)
happy += q*1000

q, m = divmod(m, 5)
happy += q*5

print(happy)

Submission status: Accepted

Solution code:
x = int(input())

a500 = x//500
a005 = (x%500)//5

ans = a500 * 1000 + a005 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

cnt_500 = X // 500
cnt_5 = (X - cnt_500 * 500) // 5

print(cnt_500 * 1000 + cnt_5 * 5)

Submission status: Accepted

Solution code:
def main():
    X = int(input())
    res = 0
    ct = X//500
    res += 1000 * ct
    X -= ct * 500

    ct = X //5
    res += 5 * ct
    print(res)
    

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
x = int(sys.stdin.readline())

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

Submission status: Accepted

Solution code:
# li = [[0] * 4 for i in range(3)]

# A = list.map(int, input().split())

x = int(input())

ans = 0
ans += (x // 500) * 1000
temp = x % 500
ans += (temp // 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:
input_line = int(input())

# print(input_line)

one_time = input_line // 500

# print(one_time)

amari = input_line%500

two_time = amari // 5

# print(two_time)

print(one_time*1000+two_time*5)

Submission status: Accepted

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

Submission status: Accepted

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

x = int(input())
d1 = x // 500
x -= d1 * 500
out = d1 * 1000

d2 = x // 5
out += d2 * 5

print(out)

Submission status: Accepted

Solution code:
x = int(input())
c = 0
while True:
    if x >= 500:
        x -= 500
        c += 1000
    elif x >= 5:
        x -= 5
        c += 5
    if x < 5:
        break
print(c)

Submission status: Accepted

Solution code:
def solve(x):
    res = 0
    res += (x // 500) * 1000
    x = x % 500
    res += (x // 5) * 5
    return res


def main():
    x = int(input())
    res = solve(x)
    print(res)


def test():
    assert solve(1024) == 2020
    assert solve(0) == 0
    assert solve(1000000000) == 2000000000


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

Submission status: Accepted

Solution code:
X = int(raw_input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
A = int(input())
total = 0
total += (A // 500) * 1000
A -= total / 2
total += (A // 5) * 5
print(int(total))

Submission status: Accepted

Solution code:
X = int(input())

c_500 = X // 500
X -= X // 500 * 500
c_5 = X // 5

print(c_500 * 1000 + c_5 * 5)

Submission status: Accepted

Solution code:
x= int(input())
a = [500,100,50,10,5,1]
ans = 0
now = x
ans += (now//500)*1000
now = now%500
ans += (now//5)*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

gohyakuen = X // 500
goen = (X % 500) // 5

ans = gohyakuen * 1000 + goen * 5

print(ans)

Submission status: Accepted

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

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 fractions import gcd
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 functools import reduce
from bisect import bisect_left, insort_left
from heapq import heapify, heappush, heappop

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
MAP = lambda: map(int, INPUT().split())
S_MAP = lambda: map(str, INPUT().split())
LIST = lambda: list(map(int, INPUT().split()))
S_LIST = lambda: list(map(str, INPUT().split()))
ZIP = lambda: zip(*(MAP() for _ in range(n)))

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


def main():
   X = INT()

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# デバッグ用
GBN_DEBUG = False
def dprn(s, i):
    if GBN_DEBUG: print(", " + s + " = " + str(i), end = "")
def dprns(s):
    if GBN_DEBUG: print(", " + s, end = "")
def dprni(i):
    if GBN_DEBUG: print(i, end=" ")
def endl(): 
    if GBN_DEBUG: print('')
def puts(s): print(s)

#本体ここから

#S = input()
X = int(input())
#S, T = input().split()
#N, M = map(int, input().split())
#W = [input() for _ in range(N)]
#A = list(map(int, input().split()))

#GBN_DEBUG = True

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

print(c500 * 1000 + c5 * 5)

Submission status: Accepted

Solution code:
# B - Golden Coins

X = int(input())

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

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())
#a,b = map(int,input().split())
#a_L = list(map(int,input().split()))
w = x

tmp = int(x/500)

ans = tmp*1000
x = x-500*tmp

tmp = int(x/5)

ans = ans + tmp*5
print(ans)