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())
happy=0
while X>=500:
    happy += 1000
    X -= 500
while X>=5:
    X -= 5
    happy += 5
print(happy)

Submission status: Accepted

Solution code:
s = int(input())

a = (s//500)*1000

b = (s%500)//5*5

print(a+b)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
x=int(input())
a=x//500 # 500円玉
b=(x-a*500)//5 # 5円玉
print(a*1000+b*5)

Submission status: Accepted

Solution code:
X = int(input())

times_500 = X // 500
g_1000 = 1000 * times_500

X = X - (500 * times_500)

times_5 = X // 5
g_5 = 5 * times_5

ans = g_1000 + g_5

print(str(ans))

Submission status: Accepted

Solution code:
X = int(input())
point_1000 = X // 500
point_5 = (X-500*point_1000)//5

print(point_5*5 + point_1000*1000)

Submission status: Accepted

Solution code:
x=int(input())
happiness = 0
if x>=500:
    ans = divmod(x,500)
    happiness += 1000*ans[0]
    x = ans[1]

if x>=5:
    ans =divmod(x,5)
    happiness += 5*ans[0]

print(happiness)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

gohun = x // 500
amari = x % 500
go = amari // 5

happy = gohun * 1000 + go * 5
print(happy)

Submission status: Accepted

Solution code:
"""基本方針：500円で両替出来るだけして、端数を5円に変換する。
"""
import math
X = int(input())
ans = 0
#以後はXを減算していく
#500円玉両替処理
ans += math.floor(X / 500) * 1000
X -= math.floor(X / 500) * 500
#5円玉両替処理
ans += math.floor(X / 5) * 5
X -= math.floor(X / 5) * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())
R=X%5
r=(X-R)%500
print(r+(X-R-r)*2)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline())
sys.stdout.write(str((n // 500) * 1000 + (n % 500 // 5) * 5))

Submission status: Accepted

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

x = int(input())
print(solve(x))

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

x = int((s - s%500)/500)
# print(x)
e = s%500
d = int((e - (e%5))/5)
# print(d)
print(x*1000 + d*5)

Submission status: Accepted

Solution code:
num = int(input())

happiest = 0
happy = 0

if num >= 500:
  happiest = int(num/500)
  num = num % 500
if num >= 5:
  happy = int(num/5)

print(int(happiest*1000+happy*5))

Submission status: Accepted

Solution code:
x = int(input())
a,b = 0,0
if x // 500 >= 1:
    a = x // 500
    x = x - a*500
if x // 5 >=1:
    b = x // 5
    x = x - b*5
if a >=1 or b >=1:
    print(a*1000+b*5)
else:
    print(0)

Submission status: Accepted

Solution code:
X = int(input())

list = [[500, 1000], [5, 5]]

div_500, mod_500 = divmod(X, 500)
div_5, mod_5 = divmod(mod_500, 5)

print("{}".format(div_500 * 1000 + div_5 * 5))

Submission status: Accepted

Solution code:
money = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
thou, amari = divmod(x, 500)
five = amari // 5

print(thou * 1000 + five * 5)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

    ans += (X//5)*5

    print(ans)


if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
X = int(input())

big = X // 500
small = (X - 500*big) // 5

answer = 1000 * big + small * 5
print(int(answer))

Submission status: Accepted

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


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

    x = int(input())
    ans = 0

    p, q = divmod(x, 500)
    ans += 1000 * p
    ans += q // 5 * 5

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N=int(input())
print('{}'.format(str(int(N/500)*1000+int(N%500/5)*5)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from math import*
n=int(input())
y= floor(n/500)
if (n-y)==0:
    print(1000*y)
else:
    x=n-y*500
    ans=(floor(x/5))*5+1000*y
    print(ans)

Submission status: Accepted

Solution code:
X = int(input())

c500 = X // 500
X -= 500 * c500

c5 = X // 5
happy = c500 * 1000 + c5 * 5
print(happy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#　%%まず500円を持ちうる個数を確認する
X = int(input())
count1 = int(X/500) #500円の枚数
#print(count1)

# %%　500円玉の合計額を引いた値から、5円玉を確認する
deducation = X - count1 * 500

count2 = int(deducation / 5)
#print(count2)

# %%　スコアを計算する
uresisa = count1 * 1000 + count2 * 5
print(uresisa)

# %%

Submission status: Accepted

Solution code:
i = int(input())
big_count = i // 500
small_count = (i - 500 * big_count) // 5

print(big_count * 1000 + small_count * 5)

Submission status: Accepted

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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
count500 = 0
count50 = 0
while x >= 500:
    x -= 500
    count500 += 1
while x >=5:
    x -= 5
    count50 += 1
print(count500 * 1000 + count50 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

l500 = x // 500

#print(l500)#
x -= l500 * 500
#print(x)#
l5 = x // 5
#print(l5)#
print(l500 * 1000 + l5 * 5)
#print('                  ')#

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())
k_500 = money // 500
moneyb = money % 500
k_5 = moneyb // 5
print(k_500 * 1000 + k_5 * 5)

Submission status: Accepted

Solution code:
input_coin=int(input())

pt500=input_coin//500
pt500_left=input_coin%500
pt5=pt500_left//5
print(1000*pt500+5*pt5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

print(result)

Submission status: Accepted

Solution code:
n = int(input())

S = n // 500
mod = n % 500
x = mod // 5

H = 1000 * S + x * 5
print(H)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(string):
    x = int(string)
    return str(x // 500 * 1000 + x % 500 // 5 * 5)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
Coin = input()
coin = int(Coin)
five_hundred = 0
five = 0
while(coin>=500):
    five_hundred += 1
    coin -= 500
while(coin>=5):
    five += 1
    coin -= 5
print(five_hundred * 1000 + five * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
money = int(input())

num_500 = int(money / 500)

remaining = int(money % 500)

num_5 = int(remaining / 5)

print('{}'.format(num_500 * 1000 + num_5 * 5 ))

Submission status: Accepted

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

Submission status: Accepted

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

x1 = x//500
x2 = x-(x1*500)
x3 = x2//5
print(x1*1000+x3*5)

Submission status: Accepted

Solution code:
def B():
    X=int(input())
    sum=0
    
    count500=int(X/500)
    sum+=count500*1000
  
    count5=int((X-(count500*500))/5)
    sum+=count5*5
    
    print(sum)
        
    
    
if __name__=='__main__':
    B()

Submission status: Accepted

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

while x >= 5:
    if x >= 500:
        cnt += 1000
        x -= 500

    elif x >= 5:
        cnt += 5
        x -= 5

print(cnt)

Submission status: Accepted

Solution code:
N = int(input())

c5 = N //500
n = N%500
c1 = n //5 
print(c5*1000+c1*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import sys
import datetime
from functools import lru_cache
readline=sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
#######################################################################################################
x=int(input())
ans=(x//500)*1000
x%=500
ans+=(x//5)*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
x = int(input())

a = x//500
b = x%500
c = b//5
d = a*1000+c*5

print(int(d))

Submission status: Accepted

Solution code:
X = int(input())

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

print(count)

Submission status: Accepted

Solution code:
s = int(input())
A = s // 500 #Aは500円玉の数
s = s - 500*A #500円玉A枚を覗いた残高
B = s // 5
print(A*1000+B*5)

Submission status: Accepted

Solution code:
def main():
    okane = int(input())
    five_handred = okane // 500
    okane -= five_handred * 500
    five = okane // 5
    print(five_handred * 1000 + five * 5)
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

ans = 0

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

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

Submission status: Accepted

Solution code:
x = int(input())

res500 = int(x / 500)
res5 = int(x % 500 / 5)

print(res500 * 1000 + res5 * 5)

Submission status: Accepted

Solution code:
x = int(input())
a500 = x // 500
tmp = x % 500
a5 = tmp // 5
print(a500 * 1000 + a5 * 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:
x = int(input())
coin500 = x // 500
coin5 = x % 500 // 5
print(coin500*1000 + coin5*5)

Submission status: Accepted

Solution code:
X = int(input())
happy = 0
while X >= 5:
  if X >= 500:
    happy += 1000
    X -= 500
    continue
  elif X >= 5:
    happy += 5
    X -= 5
    continue
  else:
    break
print(happy)

Submission status: Accepted

Solution code:
import math

m = int(input())

maisu_500 = m // 500
amari_50 = (m % 500)
maisu_50  = amari_50 // 5
happy = maisu_500*1000 + maisu_50*5

print(math.floor(happy))

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

w = 0
w=(x//500)*1000
wk = x%500
w += (wk//5)*5
print(w)

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

a = x//500

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

print(a*1000+5*b)

Submission status: Accepted

Solution code:
X = int(input())

sum, X = divmod(X, 500)
sum *= 1000
sum += X - (X % 5)

print(sum)

Submission status: Accepted

Solution code:
import sys

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


def solve():
    X = int(rl())
    ans = 1000 * (X // 500)
    X -= ans // 2
    ans += 5 * (X // 5)
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
s = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
k = eval(input())
print(  (k//500)*1000+((k%500)//5)*5  )

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 30 20:12:26 2020

@author: black
"""


X = int(input())
Hapiness = 0

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

Y = X//500
Z = (X-Y*500)//5

print(1000*Y+5*Z)

Submission status: Accepted

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

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())
point = 0
while x != 0:
    if x >= 500:
        result = x // 500
        summ = (500 * result)*2
        point = point + summ
        remainder = x % 500
        x = remainder
    if x >= 5:
        result = x // 5
        summ = 5 * result
        point = point + summ
        break;
print(point)

Submission status: Accepted

Solution code:
X = int(input())

C500 = X // 500
X = X % 500
C5 = X // 5

print(C500*1000+C5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

x = int(input())

fh = x // 500
mod = x - 500 * fh
f = mod // 5

print(fh*1000 + f*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

x=int(n//500)
y=int((n-x*500)//5)

print(x*1000+y*5)

Submission status: Accepted

Solution code:

get = int(input())

s1 = int(get/500)
s2 = int((get%500)/5)

r1 = s1 * 1000
r2 = s2 * 5
print(r1+r2)

Submission status: Accepted

Solution code:
i=int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

#500yen
point += 1000 * (x // 500)
x %= 500

#5yen
point += 5 * (x // 5)

print(point)

Submission status: Accepted

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

Submission status: Accepted

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

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:
import math
numeric = int(input())
result = math.floor(numeric / 500)*1000
intermediate = numeric - math.floor(numeric / 500)*500
result = result + math.floor(intermediate / 5)*5
print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
def covid(num):
  if num==0:
    return 0
  else:
    happy=0
    fund=num//500
    num-=fund*500
    happy+=fund*1000
    happy+=num//5*5
    return happy
print(covid(n))

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())
ans =0 
while(1):
    if X < 5:
        break
    elif X<500:
        tmp = X // 5
        ans +=tmp*5
        X = X% 5
    else:
        tmp = X // 500
        ans +=tmp*1000
        X = X %500
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:
import math
import string
import collections
from collections import Counter


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

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

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
bigpleasure = (x//500)*1000
smallpleasure = ((x%500)//5)*5

print(bigpleasure+smallpleasure)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

X = int(input())
count = [0, 0]
count[0] = math.floor(X / 500)
count[1] = math.floor((X - (500 * count[0])) / 5)

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

s = 0

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

print(s)

Submission status: Accepted

Solution code:
#abc160b
x=int(raw_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) // 5
print(a * 1000 + b * 5)

Submission status: Accepted

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

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:
#!/usr/bin/env python

from sys import stdin, stderr

def main():
   N = int(stdin.readline())

   res = (N // 500) * 1000
   
   N %= 500

   res += (N // 5) * 5
   
   print(res)

   return 0

if __name__ == '__main__': main()

Submission status: Accepted

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

y1 = x - x1*500
x2 = y1 //5

print(x1*1000 + x2* 5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(c500 * 1000 + c5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
x=int(input())
d,m=divmod(x,500)
ans=d*1000+(m//5)*5
print(ans)

Submission status: Accepted

Solution code:
import sys


def input():
    return sys.stdin.readline().strip()


X = int(input())

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

Submission status: Accepted

Solution code:
# A = [list(map(int, input().split())) for _ in range(3)]
X = int(input())
# B = [int(input()) for _ in range(n)]
# A = list(map(int, input().split()))
# a, b = map(int, input().split())
ans = 0
ans += X//500*1000
ans += (X % 500)//5*5
print(ans)

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

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

Submission status: Accepted

Solution code:
x = int(input())

x2, m2 = divmod(x,500)
x3, m3 = divmod(m2,5)
print(x2*1000+x3*5)

Submission status: Accepted

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

Submission status: Accepted

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

# 入力はstringで入る．
# intにしたければ int(input())
# floatで受け取ると 1.0 になる．

# 入力 : X
X = int(input())

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

Submission status: Accepted

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

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())
res=0
if X!=0:
    tmp=X//500
    res=tmp*1000+((X-tmp*500)//5)*5
print(res)

Submission status: Accepted

Solution code:
num = int(input())
happiness = 0
num1 = num // 500
num2 = num % 500 

num3 = num2 // 5 

happiness += num1 * 1000 + num3 * 5

# while num > 500:
#     num = num - 500
#     happiness += 1000 
# while num > 5:
#     num = num - 5 
#     happiness += 5 

print (happiness)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

noguchi = X // 500
goen = X % 500 // 5

print(noguchi * 1000 + goen * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections

local = False
if local:
    file = open("B.txt", "r")

def inp():
    if local:
        return file.readline().rstrip()
    else:
        return input().rstrip()

X = int(inp())

count500 = X // 500
X-=count500*500
count5 = X // 5

print(str(1000*count500+5*count5))

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

happy = 0

# 500円の処理
num_500 = x // 500
happy += num_500 * 1000

x -= num_500 * 500

# 5円の処理
num_5 = x // 5
happy += num_5 * 5

x -= num_5 * 5

print(happy)

Submission status: Accepted

Solution code:
money = int(input())

a = money // 500

money -= a * 500
b = money // 5

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

Submission status: Accepted

Solution code:
from sys import stdin


inp = stdin.readline

t = int(inp().strip())

print(str(1000*(t//500) + 5*((t-500*(t//500))//5)))

Submission status: Accepted

Solution code:
X = int(input())

coin_500 = X // 500
x = X % 500
coin_5 = x // 5
print(coin_500 * 1000 + coin_5 * 5)

Submission status: Accepted

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

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:
a=input()
b=int(a)
takaH=0
while b>0:
    if b>=500:
        takaH+=1000
        b=b-500
    elif b>=5:
        takaH+=5
        b=b-5
    elif b>=100:
        b=b-100
    elif b>50:
        b=b-50
    elif b>=10:
        b=b-10
    else :
        b=b-1
print(takaH)

Submission status: Accepted

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