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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

syou_500 = n//500
amari = n % 500
syou_5 = amari//5
print(syou_500*1000 + syou_5*5)

Submission status: Accepted

Solution code:
X = int(input())

mod = X % 500
num = X//500

print(num * 1000 + mod // 5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(raw_input())#,k = map(int, raw_input().split(' '))

cumul = 0
cumul += (x / 500) * 1000
x %= 500

cumul += (x / 5) * 5

print cumul
#print 'Yes ' if len(s) >= 6 and s[2] == s[3] and s[4] == s[5] else 'No' #f(n,k)

Submission status: Accepted

Solution code:
import math
X = int(input())

useshisa = 0
n_500 = math.floor(X/500)
n_5 = math.floor((X-n_500*500)/5)

ureshisa = n_500*1000 + n_5*5

print(ureshisa)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
count_500 = X // 500
count_5 = (X - 500*count_500) // 5

print(count_500*1000+count_5*5)

Submission status: Accepted

Solution code:
S = int(input())

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

print(a*1000+c*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(H)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue Apr 28 21:57:46 2020
"""

import sys
#import numpy as np

sys.setrecursionlimit(10 ** 9)
#def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9+7

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

a=X//500

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

print(1000*a+5*b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
X = int(input())
happiness = 0

happiness += math.floor(X / 500) * 1000
X -= 500 * math.floor(X / 500)
happiness += math.floor(X / 5) * 5
X -= 5 * math.floor(X / 5)
print(happiness)

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

hapiness =0

hapiness += (X // 500) * 1000
X = X % 500

hapiness += (X // 5) * 5

print(hapiness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

fivehundred = int(X/500)
five = int((X-fivehundred*500)/5)

total = 1000*fivehundred + 5*five

print(total)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    x = int(input())
    t = x // 500 * 1000
    f = (x % 500) // 5 * 5
    print(t + f)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x= int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(siawase)

Submission status: Accepted

Solution code:
import math

x=int(input())

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

print(a+b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys;input=lambda:sys.stdin.readline().rstrip();aint=lambda:int(input());ints=lambda:list(map(int,input().split()))
import math;floor,ceil=math.floor,math.ceil
from collections import deque
Yes=lambda b:print('Yes')if b else print('No');YES=lambda b:print('YES')if b else print('NO')
is_even=lambda x:True if x%2==0 else False

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())

m=int(n/500)

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

total=1000*m+5*k

print(total)

Submission status: Accepted

Solution code:
import sys

n = int(input())

buf = 0            #嬉しさポイント
m = 0               #残金

if n == 0:
    print("0")
    sys.exit()

def check(x,buf):
    if x >= 500:
        m = x%500
        buf += (x//500)*1000
        buf = check(m,buf)
        return buf
    elif 0 < x >= 5:
        buf += (x//5)*5
        return buf
    else:
        return buf

kei = check(n,buf)
print(kei)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

  ans = 0

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

  ans += (x // 5) * 5

  print(ans)

main()

Submission status: Accepted

Solution code:

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

  ans = 0

  while x >= 500:
    x -= 500
    ans += 1000

  while x >= 5:
    x -= 5
    ans += 5

  print(ans)

main()

Submission status: Accepted

Solution code:

X = int(input())

# 500円玉につき1000、五円玉につき5ポイントゲット

def main():
    point = int((X/500)) * 1000
    remain = int(X % 500)
    point += int((remain/5)) * 5
    print(point)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
gohyaku=0
if x >= 500:
    gohyaku=x//500
goen=(x-gohyaku*500) // 5
print((gohyaku*1000)+(goen*5))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

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

Submission status: Accepted

Solution code:
def solve(x):
    result = 0
    fh_yen = x // 500
    x -= 500 * fh_yen
    result += 1000 * fh_yen
    f_yen = x // 5
    result += 5 * f_yen
    return result


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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())
tho = x//500
x -= 500*tho

fiv = x//5
ple = 1000*tho + 5*fiv

print(ple)

Submission status: Accepted

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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

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

#############
# Main Code #
#############

X = inputI()

a = X//500

r = X%500

b = r//5

print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

n_500 = x // 500
y = x % 500

n_5 = y //5

print(1000*n_500 + 5*n_5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

happy = 1000*n500 + 5*n5
print(happy)

Submission status: Accepted

Solution code:
X = int(input())

num_500 = X // 500
num_5 = (X - 500 * num_500) // 5

print(1000 * num_500 + 5 * num_5)

Submission status: Accepted

Solution code:
#2020-03-28
#ABC
S = int(input())
count = int(S / 500)
sum = 1000 * count
S = S - 500*count
sum = sum + 5*(int(S/5))
print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Gold500 = int(X / 500)
Gold005 = int((X - (500 * Gold500)) / 5)
Y = Gold500 * 1000 + Gold005 * 5
print(Y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
A=0
G=0
N=0
M=0
Z=0
N=int(X/500)
M=int(X%500)
Z=int(M/5)
N=N+Z
for i in range(0,N):
    if X>=500:
        X=X-500
        G=G+1000
    elif X>=5:
        X=X-5
        G=G+5
    else:
        break
        
print(G)

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

happy= 0
if X%500 >= 0:
    happy = X//500*1000
    X = X%500
else:
    pass

if X%5 >= 0:
    happy = happy + X//5*5
else:
    pass

print(happy)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#coin : happy
#500 : 1000
#5 : 5
X = int(input())
x500 = X // 500 * 1000
x5 = (X - X // 500 * 500) // 5 * 5
print(x500 + x5)

Submission status: Accepted

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

ans = 0
fh, mod = divmod(X, 500)
f, _ = divmod(mod, 5)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

thou = X//500
fifth = (X-thou*500)//5

print(thou*1000 + fifth*5)

Submission status: Accepted

Solution code:
x = int(input())

fivemillion = int(x / 500)
five = int((x % 500) / 5)

print(fivemillion * 1000 + five * 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())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
print(str( X//500*1000 + (X%500)//5*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())
t = 0
while x >=500 :
    x = x - 500
    t += 1000
while x >=5 :
     x = x - 5
     t += 5
print(t)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

GoHya = int(X/500)
Go = int((X-GoHya*500)/5)

happiness = int(GoHya*1000 + Go*5)
print(happiness)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a*1000+b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#  ABC 160: B – Golden Coins
X = int(input())
print(1000 * (X // 500) + 5 * ((X % 500) // 5))

Submission status: Accepted

Solution code:
"""
import random
import functools
import copy
import bisect
import array
import re
import collections
import heapq
import fractions
import itertools
import string
import math
from operator import itemgetter as ig
from bisect import bisect_left, bisect_right, insort_left, insort_right
from itertools import permutations, combinations, product, accumulate, groupby
from heapq import heappush, heappop
from collections import deque, defaultdict, Counter
import sys
sys.setrecursionlimit(10 ** 7)
# import numpy as np

inf = 10 ** 20
INF = float("INF")
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]
ddn9 = ddn + [(0, 0)]
'''for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:'''
"""
from collections import deque, defaultdict, Counter
import math
import sys
sys.setrecursionlimit(10 ** 7)


def wi(): return list(map(int, sys.stdin.readline().split()))
# WideIntPoint


def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]


def ws(): return sys.stdin.readline().split()


def si(): return int(sys.stdin.readline())  # SingleInt


def ss(): return input()


def hi(n): return [si() for _ in range(n)]


def hs(n): return [ss() for _ in range(n)]  # HeightString


def s_list(): return list(input())


def mi(n): return [wi() for _ in range(n)]  # MatrixInt


def mip(n): return [wip() for _ in range(n)]


def ms(n): return [ws() for _ in range(n)]


def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[
    0]] for _ in range(n)]  # NumberGrid


def grid(n): return [s_list() for _ in range(n)]


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def lcm(a, b):
    """a,bの最小公倍数"""
    return a * b // gcd(a, b)


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python
import sys
from collections import Counter
from itertools import permutations, combinations
from fractions import gcd
from math import ceil, floor
import bisect
sys.setrecursionlimit(10 ** 6)
inf = float("inf")

def input():
    return sys.stdin.readline()[:-1]

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

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    x = int(rl())
    a = 1000 * (x // 500)
    b = 5 * (x % 500 // 5) 
    print(a + b)
    
    
if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
X = int(input())

Y = X//500
Z = X - Y*500
S = Z//5

ans = print(Y*1000 + S*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

ureshisa = 0
ureshisa = int(X/500)*1000

X = X%500

ureshisa += int(X/5)*5

print(ureshisa)

Submission status: Accepted

Solution code:
a = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
'''
n, m = map(int, input().split())
n = int(input())
A = list(map(int, input().split()))
for test in range(int(input())):
'''
inf = 100000000000000000  # 1e17

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

Submission status: Accepted

Solution code:
x = int(input())
waru_500 = x // 500
amari = x % 500
waru_5 = amari // 5

print(waru_500 * 1000 + waru_5 * 5)

Submission status: Accepted

Solution code:
# solution

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

Submission status: Accepted

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

Submission status: Accepted

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

X = int(input())

up = X//500
down = (X%500)//5

print(1000*up + 5*down)

Submission status: Accepted

Solution code:
s=int(input())


Q500,mod500=divmod(s,500)
Q5=mod500//5

URESHISA=Q500*1000+Q5*5

print(URESHISA)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np


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


x = int(input())
solve()
#a = [int(i) for i in input().split(" ")]

Submission status: Accepted

Solution code:
#ライブラリの読み込み
import math

#入力値の格納
x = int(input())

#得点の計算
score = int((x // 500 * 1000) + (x % 500 // 5 * 5))

#表示
print(score)

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

import sys
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()


x = ni()

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

Submission status: Accepted

Solution code:
x = int(input())
x_500 = int(x / 500)
x_5 = int((x - 500 * x_500) / 5)

happy = x_500 * 1000 + x_5 * 5

print(happy)

Submission status: Accepted

Solution code:
X = int(input())

x, y = X // 500, X % 500
z = y // 5
print(1000 * x + 5 *z)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(a*1000 + 5*b)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    x = int(input())
    ans = 0

    if x >= 500:
        tmp = x // 500
        ans += tmp * 1000
        x = x % 500
    
    if x >= 5:
        tmp = x // 5
        ans += tmp * 5
    
    print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
coins = int(input())
happiness = 0


def happiness_point(remainder, num, point, all_point):
    result = divmod(remainder, num)
    all_point += result[0] * point
    remainder = result[1]
    return remainder, all_point


if coins / 500 >= 1:
    coins, happiness = happiness_point(coins, 500, 1000, happiness)

if coins / 5 >= 1:
    coins, happiness = happiness_point(coins, 5, 5, happiness)

print(happiness)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

a = 0


gold_coin = [500,5]
point = [1000,5]

for i in range(2):
    a = a + (X//gold_coin[i])*point[i]
    X = X%gold_coin[i]

print(a)

Submission status: Accepted

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

A = 1000*y+5*a
print(A)

Submission status: Accepted

Solution code:
x = int(input())

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

print(ans)

Submission status: Accepted

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

else:
    print((X//5)*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return


def lcm(n, m):
    return int(n * m / gcd(n, m))


def coprimize(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


def find_gcd(list_l):
    x = reduce(gcd, list_l)
    return x


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
a = int(input())
a1 = math.floor(a / 500)
a2 = a % 500
a3 = math.floor(a2 / 5)

print(a1 * 1000 + a3 * 5)

Submission status: Accepted

Solution code:
X = int(input())
happy = 0
happy += (X // 500) * 1000
X -= (X // 500) * 500 
happy += (X // 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:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

gh = X//500
g = X%500//5

print(gh * 1000 + g * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(a*1000 + b*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

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

ans = 0

while n >= 500:
    n -= 500
    ans += 1000
while n >= 5:
    n -= 5
    ans += 5

print(ans)

Submission status: Accepted

Solution code:
X=int(input())

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

print(a*1000+5*b)