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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

coin500 = divmod(s,  500)
coin5 = divmod(coin500[1], 5)

print(coin500[0] * 1000 + coin5[0] * 5)

Submission status: Accepted

Solution code:
X = int(input())

a = divmod(X, 500)
b = divmod(a[1], 5)

print(1000*a[0] + 5*b[0])

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
has = int(input())
canbe = 0
_500, has = divmod(has, 500)
canbe += _500 * 1000
_5, has  = divmod(has, 5)
canbe += _5 * 5
print(canbe)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
n500 = X // 500
##残金
num = X - 500 * n500
n5 = num // 5

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
cnt = 0
q = x // 500
cnt += (q * 1000)
w = x % 500
e = w // 5
cnt += (e * 5)
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
d = input()

x = int(d)

a = x%500
b = int(x/500)
y = b*1000

c = int(a/5)
z = c*5

print(y+z)

Submission status: Accepted

Solution code:
x = int(input())
a = x // 500
print(a*1000 + ((x-a*500) // 5)*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:
# import sys
# S=input()
# if S[2]==S[3] and S[4]==S[5]:
#   print("Yes")
# else:
#   print("No")
X=int(input())
h500=X//500
h5=(X-(h500*500))//5

print(h500*1000+h5*5)

Submission status: Accepted

Solution code:
x = int(input())

num_500 = x // 500
x = x - x // 500 * 500


num_5 = x // 5
print(num_500 * 1000 + num_5 * 5)

Submission status: Accepted

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


def solve(X: int):
    gohyaku = X // 500
    nokori = X % 500
    go = nokori // 5
    print(1000*gohyaku + 5 * go)
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

if __name__ == "__main__":
    X = int(input())
    ret = 0
    ret += math.floor(X / 500) * 1000
    ret += math.floor((X % 500) / 5) * 5
    print(ret)

Submission status: Accepted

Solution code:
x = int(input())

# 500 = 1000
# 5 = 5
ans = 0

ths = x // 500
ans += 1000 * ths
x = x - 500 * ths

fives = x // 5
ans += 5 * fives

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

i = 1
while X >= 500 * i:
    i += 1

X -= (i - 1) * 500

j = 1
while X >= 5 * j:
    j += 1

ans = (i - 1) * 1000 + 5 * (j - 1)
print(ans)

Submission status: Accepted

Solution code:
x = int(input())
q_500,mod = divmod(x,500)
q_5,mod = divmod(mod,5)
print(q_500*1000+q_5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

x = int(input())

num_500 = 0
num_5 = 0

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

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

ans = num_500 * 1000 + num_5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math
# map(int, input().split())
#
# input().split()

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

Submission status: Accepted

Solution code:
d = int(input())

r = int(d // 500 * 1000)
d %= 500
r += int(d // 5 * 5)
print(r)

Submission status: Accepted

Solution code:
from collections import defaultdict, deque
import sys
import heapq
import bisect
import itertools
import queue
import copy
import time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

x = inp()
ans = 0
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
c=b//5
print(a*1000+c*5)

Submission status: Accepted

Solution code:
def gladness(x):
    thousands = (x // 500) * 1000
    x = x % 500
    fives = (x // 5) * 5
    return thousands + fives

n = input()
print(gladness(int(n)))

Submission status: Accepted

Solution code:
X = int(raw_input())

n500 = int(X / 500)
X -= n500 * 500
if X >= 0:
    n5 = int(X/5)
    X -= n5 * 5
    print n500*1000 + n5*5
else:
    print n500*1000

Submission status: Accepted

Solution code:
S=int(input())
r500=int(S/500)
S2 = S - 500*r500
r5 = int(S2/5)
print(r500*1000+r5*5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

while X>=500:
    count+=(X//500)*1000
    X = X%500
    
while X>=5:
    count+=(X//5)*5
    X = X%5
    
print(count)

Submission status: Accepted

Solution code:
i = int(input())

coin500 = i // 500
coin5 = (i - coin500*500) // 5
print(coin500*1000 + coin5*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())
num500 = X // 500
num5 = (X - num500 * 500) // 5
print(num500 * 1000 + num5 * 5)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

x = int(input())

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

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

print(ans)

Submission status: Accepted

Solution code:
x = int(input())

a = x // 500

x2 = x - (500 * a)

b = x2 // 5

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())


a = X // 500
b = X % 500
ans = a * 1000

b = b // 5
ans = ans + b*5

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
X = int(input())

num_500 = int(X/500)
num_5 = int((X%500) / 5)

print((num_500*1000)+(num_5)*5)

Submission status: Accepted

Solution code:
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)

#入力
x = int(input())
coin = [500,5,100,50,10,1]
#解答
c = [0,0,0,0,0,0]
for i in range(len(coin)):
    c[i] = x//coin[i]
    x -= coin[i]*c[i]
ans = 0
ans += c[0]*1000
ans += c[1]*5
print(ans)
#出力

Submission status: Accepted

Solution code:
S = int(input())

S1 = S % 500
A = S//500

B = S1 // 5

print(A*1000+B*5)

Submission status: Accepted

Solution code:
x = int(input())

praise_500 = x // 500 * 1000
x = x - (x // 500)*500

praise_5 = x // 5 * 5

print(praise_500 + praise_5)

Submission status: Accepted

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

Submission status: Accepted

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

    A=N//500
    Am=N%500
    B=Am//5

    print(A*1000+B*5)
main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N= int(input())

p, mod = divmod(N, 500)


q, mod = divmod(mod, 5)


print(p*1000+q*5)

Submission status: Accepted

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

#print(X)

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

#print(X)
#print(joy)

joy += (X // 5) * 5
X = X % 5

#print(X)
print(joy)

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
money = int(input())

y_500 = money // 500

happiness = y_500 * 1000

change = money - 500 * y_500

y_5 = change // 5

happiness += y_5 * 5

print(happiness)

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

d, m = divmod(X, 500)

d2, m2 = divmod(m, 5)

print(d * 1000 + d2 * 5)

Submission status: Accepted

Solution code:
X = int(input())

n_coin_500 = X // 500
n_coin_5 = X % 500 // 5

happy_500 = 1000 * n_coin_500
happy_5 = 5 * n_coin_5

result = happy_500 + happy_5
print(result)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
def main():
    s = int(input().strip())
    a = s // 500
    b = (s - 500 * a) // 5
    ans = 1000 * a + 5 * b
    print(int(ans))


if __name__ == '__main__':
    main()

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

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

while(X>=5):
    happiness+=5
    X-=5

print(happiness)

Submission status: Accepted

Solution code:
x = int(input())

y = 0
while x >= 500:
    y += 1
    x -= 500

z = x // 5
print(1000*y + z*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
pt1000 = 0
pt5 = 0

if X >= 500:
    while X >= 500:
        X = X - 500
        pt1000 += 1
    while X >= 5:
        X = X-5
        pt5 += 1
else:
    while X >= 5:
        X = X-5
        pt5 += 1

print(pt1000*1000 + pt5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())

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

Submission status: Accepted

Solution code:
X = int(input())
hya = X // 500
go = (X - hya*500)//5

print(hya*1000+go*5)

Submission status: Accepted

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

sum=a*1000+b*5

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())  # ここで標準入力
out = 0

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

print(int(out))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

  print(happiness)
if __name__ == "__main__":
  solve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def a():
    S = input()

    if S[3] == S[2] and S[4] == S[5]:
        print("Yes")
    else:
        print("No")


def b():
    X = int(input())
    y_500 = (X // 500) * 1000
    y_5 = ((X - (y_500 / 2)) // 5) * 5
    print(int(y_500 + y_5))


def c():
    print()


def d():
    print()


def e():
    print()


b()

Submission status: Accepted

Solution code:
price = int(input())

coin_500 = price // 500
price -= 500 * coin_500
coin_5 = price // 5

price -= 5 * coin_5
coin_100 = price // 100
price -= 100 * coin_100
coin_50 = price // 50
price -= 50 * coin_50
coin_10 = price // 10
price -= 10 * coin_10
coin_1 = price

print(1000 * coin_500 + coin_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
coin = [500, 5, 1]

for i in coin:
    r, X = divmod(X, i)
    if i == 500:
        ans += r * 1000
    elif i == 5:
        ans += r * 5
    else:
        pass
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())
a = x%500
#５００円玉の枚数
b = int((x-a)/500)
#残りのお金
c = x-(b*500)
d = c%5
#５円玉の枚数
e = int((c-d)/5)
print(b*1000 +e*5)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
X = int(input())
n_1000 = X//500
u_1000 = n_1000*1000
n_5 = (X - n_1000*500)//5
u_5 = n_5*5
total = u_1000+u_5
print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

Solution code:
s = int(input())

ans = 0
if s >= 500:
    ans += (s//500)*1000
    s = s - (s//500)*500

if s >= 5:
    ans += (s//5)*5

print(ans)

Submission status: Accepted

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

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

total = 0

(a, X) = divmod(X, 500)
(b, X) = divmod(X, 5)

print(a * 1000 + b * 5)

Submission status: Accepted

Solution code:
import sys
import math
i=int(input())
j,k=divmod(i,500)
print(j*1000+5*math.floor(k/5))

Submission status: Accepted

Solution code:
yen = int(input())
happy = 0
while(yen >= 5):
    if(yen >= 500):
        happy += (yen//500)*1000
        yen = yen % 500
    else:
        happy += (yen//5)*5
        yen = yen % 5
print(happy)

Submission status: Accepted

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

print(z)

Submission status: Accepted

Solution code:
x = int(input())
count = 0
count_2 = 0
while x > 0:
    if (x >= 500):
        x -= 500
        count += 1
    else:
        break

while x > 0:
    if (x >= 5):
        x -= 5
        count_2 += 1
    else:
        break

print(1000 * count + 5 * count_2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

h_500 = X // 500
h_5 = (X % 500) // 5

print(h_500*1000 + h_5*5)

Submission status: Accepted

Solution code:
import sys

n = int(sys.stdin.readline().strip())

hund = n // 500
remain = n - hund * 500

five = remain // 5
print(hund * 1000 + five * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

fh_joy = 0
five_joy = 0

amari = X
while amari >= 500:
    amari -= 500
    fh_joy += 1000
while amari >= 5:
    amari -= 5
    five_joy += 5
    
print(fh_joy + five_joy)

Submission status: Accepted

Solution code:
x = int(input())

ans_1 = x // 500 

ans_2 = (x - ans_1*500) // 5

ans = (ans_1 * 1000) + (ans_2 * 5)

print(ans)

Submission status: Accepted

Solution code:
x = int(input())
satu = x // 500
nokori = x - (500 * satu)
coin = nokori // 5
print(satu*1000+coin*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:
money = int(input())
gohyaku = 0
go = 0
while money >= 500:
  money -= 500
  gohyaku +=1
while money >= 5:
  money -= 5
  go +=1
print(gohyaku * 1000 + go * 5)

Submission status: Accepted

Solution code:
X = int(input())

H = 0
X2 = int(X/500)
H += X2 * 1000
X3 = X - X2 * 500
H += int(X3/5) * 5

print(H)

Submission status: Accepted

Solution code:
x = int(input())

res_500 = 0
res_5 = 0
while x >= 500:
    x -= 500
    res_500 += 1

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

print(res_500*1000 + res_5*5)

Submission status: Accepted

Solution code:
import sys
import numpy as np
import itertools
from collections import deque

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

# input
X = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

Solution code:
X=int(input())

Grad_500=1000* (X//500)
X-=500*(X//500)
Grad_50 =5* (X//5)

print(Grad_50+Grad_500)

Submission status: Accepted

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

while(1):
    if(X >= 500):
        X = X - 500
        uresisa = uresisa + 1000
        continue
    elif(X >= 5):
        X = X - 5
        uresisa = uresisa + 5
        continue
    else:
        break

print(uresisa)

Submission status: Accepted

Solution code:
X = int(input())

m = X // 500 
n = (X - 500*m) // 5

print(m*1000 + n*5)

Submission status: Accepted

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

@author: liang
"""

money = int(input())
score = 0

score += money//500 *1000  # 500 -> 1000
score += money%500 //5 *5

print(score)

Submission status: Accepted

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

Submission status: Accepted

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

print(C)

Submission status: Accepted

Solution code:
m = int(input(''))

e1 = m // 500
m = m-(e1*500)
e2 = m // 5

e = e1*1000 + e2*5

print(e)

Submission status: Accepted

Solution code:
N = int(input())

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

print(x*1000+y*5)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
money = int(input())
count_500 = int(money/500)
count_5 = int((money - count_500*500) / 5)
happy = count_500 * 1000 + count_5 * 5
print(happy)

Submission status: Accepted

Solution code:
X = int(input())

res = 0

X500, mod = divmod(X, 500)
X5 = mod // 5

res = X500 * 1000 + X5 * 5

print(res)

Submission status: Accepted

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

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

print( a500 * 1000 + a5 * 5 )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
no=int(input())
temp=no
th=0
f=0
if(temp>=500):
  th=temp//500
  temp=temp%500

if(temp>=5):
  f=temp//5
  temp=temp%5

print((th*1000)+(f*5))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=int(input())

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
x=int(input())
q, modx =divmod(x, 500)
r, mody =divmod(modx, 5)

print(int(q*1000+r*5))
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
"1行1つの整数を入力を取得し、整数と取得する"


#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ

'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation


#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

u500 = ( x // 500 ) * 1000
u5 = ( ( x % 500 ) // 5 ) * 5

print(u500 + u5)