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

Submission status: Accepted

Solution code:
x = int(input())

ans_500 = x // 500
ans_5 = (x % 500) // 5

print(ans_500 * 1000 + ans_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

q1 = X // 500
mod1 = X % 500

q2 = mod1 // 5

print(q1 * 1000 + q2 * 5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

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

print(res)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N =int(input())

hap1 = N // 500
N -= hap1 * 500

hap2 = N // 5

print(hap1*1000 + hap2*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

q, mod = divmod(X,500)

q2, mod2 = divmod(mod,5)

print(q*1000+q2*5)

Submission status: Accepted

Solution code:
x = int(input())

uresen = x // 500 * 1000

urego = x % 500 // 5 * 5

print(uresen + urego)

Submission status: Accepted

Solution code:
X=int(input())

Acoin=X//500
Bcoin=(X-500*Acoin)//5

print(Acoin*1000+Bcoin*5)

Submission status: Accepted

Solution code:
X = int(input())

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

print(c500 * 1000 + c5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

n_500 = X // 500

num = X - n_500 * 500

n_5 = num // 5

print(n_500 * 1000 + n_5 * 5)

Submission status: Accepted

Solution code:
X = int(input())

s_500 = X // 500
x_500 = X % 500
s_5 = x_500 // 5

print((s_500 * 1000) + (s_5 * 5))

Submission status: Accepted

Solution code:
x = int(input())
u500 = 1000
u5 = 5

n500 = x // 500
n5 = (x%500)//5
a = n500*u500 + n5*u5
print(int(a))

Submission status: Accepted

Solution code:
X = int(input())
ans = (X//500)*1000
X -= ans//1000*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:
l=[500,5]
ans=0
n=int(input())
ha=[1000,5]
for i in range(2):
  ans+=(n//l[i])*ha[i]
  n%=l[i]
print(ans)

Submission status: Accepted

Solution code:
a=int(input())

happy500 = a//500
happy5 = (a%500)//5

print(happy500*1000 + happy5*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())
A = X // 500
B = X - A*500
C = B // 5
print(A*1000+C*5)

Submission status: Accepted

Solution code:
X = int(input())

fh = X // 500
fd = (X-500*fh)//5
delight = 1000*fh + 5*fd
print(delight)

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

Submission status: Accepted

Solution code:
n = int(input())
score = 0

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

score +=  5*(n//5)

print(score)

Submission status: Accepted

Solution code:
# from sys import stdin


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

Submission status: Accepted

Solution code:
X = int(input())

ans1000 = X // 500
amari = X % 500
ans5 = amari //5

print(ans1000 * 1000 + ans5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

x = sys.stdin.readline()
x = int(x)

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

print(sum)

sys.stdout.flush()

Submission status: Accepted

Solution code:
if __name__ == '__main__':
	X = int(input())
	u1 = X // 500
	u2 = (X%500) // 5
	ans = u1 * 1000 + u2 * 5
	print(ans)

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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


def solve(X: int):
    f=(X//500)*1000
    ft=((X%500)//5)*5
    print(f+ft)
    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:
def b160(x):

    ans = 0

    ans += (x // 500) * 500 * 2
    nokori = x % 500
    ans += (nokori // 5) * 5

    return ans

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
m = int(input())

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

ans = c500 * 1000 + c5*5
print(ans)

Submission status: Accepted

Solution code:
x = int(input())						# 5

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

print(a+b)

Submission status: Accepted

Solution code:
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())

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

Submission status: Accepted

Solution code:
X = int(input())
n1 = X // 500
r = X % 500
n2 = r // 5

print(n1 * 1000 + n2 * 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())
result = 0

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

print(result)

Submission status: Accepted

Solution code:
X = int(input())

money_500 = X // 500
money_5 = (X % 500) // 5

print(money_500 * 1000 + money_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq


def dfs(s, prev, pre):
  val[s] += Ope[s] + prev
  for i in G[s]:
    if(i == pre):
      continue
    dfs(i, val[s], s)

def bfs(sx, sy, n):
  que = deque([[sy,sx]])
  while que:
    y,x = que.popleft()
    for i,j in D:
      if(x+i<0 or y+j<0 or x+i>W-1 or y+j>H-1):
        continue
      dist = G[y+j][x+i]
      if(G[y+j][x+i] != "X"):
        if(type(G[y+j][x+i]) is str):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        elif(dist>G[y][x]+1):
          G[y+j][x+i] = G[y][x]+1
          que.append([y+j,x+i])
        

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


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]



X = int(input())
ans = 0

while True:
  if(X-500<0):
    break
  else:
    ans += 1000
    X -= 500

while True:
  if(X-5<0):
    break
  else:
    ans += 5
    X -= 5


print(ans)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

x_500 = x//500
x_5 = (x%500)//5

ans = x_500*1000 + x_5*5

print(ans)

Submission status: Accepted

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

  num_500 = int(s /500)
  
  num_5 = int((s % 500) / 5)
  
  score = 1000 * num_500 + 5 * num_5 
  
  print(score)
main()

Submission status: Accepted

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


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

    r_500 = x // 500
    r_5 = (x % 500) // 5

    print(int(r_500 * 1000 + r_5 * 5))


if __name__ == '__main__':
    main()

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

Submission status: Accepted

Solution code:
X = int(input())
five_hund_num = int(X/500)
rem = X - 500*five_hund_num
five_num = int(rem/5)
result = 1000*five_hund_num+5*five_num
print(result)

Submission status: Accepted

Solution code:
a=int(input())


happy = 1000*(a//500)
a=a%500

happy+= 5*(a//5)
print(happy)

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())
a, b = divmod(n, 500)
c, d = divmod(b, 5)
print((a*1000)+(c*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:
x = int(input())

c1 = x // 500

x = x - 500*c1

c2 = x // 5

print(c1*1000 + c2*5)

Submission status: Accepted

Solution code:
X = int(input())

happy = 0

yen_500 = int(X/500)
yen_5 = int((X-500*yen_500)/5)

print(1000*yen_500 + 5*yen_5)

Submission status: Accepted

Solution code:
X = int(input())

big = X // 500
remX = X - big * 500
small = remX // 5

print(big * 1000 + small * 5)

Submission status: Accepted

Solution code:
# 2020/03/28
# AtCoder Beginner Contest 160 - B

# Input
x = int(input())

# Calc
x500 = x // 500
wk_x = x % 500
x5 = wk_x // 5

ans = x500 * 1000 + x5 * 5

# Output
print(ans)

Submission status: Accepted

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

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

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

print(hp)

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:

def solve():
    X = int(input())
    coin500 = X//500
    coin5 = (X % 500)//5

    print(coin500*1000+coin5*5)


# Solve
if __name__ == "__main__":
    solve()

Submission status: Accepted

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

Submission status: Accepted

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

n500=N//500

N-=n500*500

n5=N//5

print(n500*1000+n5*5)

Submission status: Accepted

Solution code:
X = int(input())

count_500 = X // 500
count_5 = (X-count_500*500) // 5

u = count_500 * 1000 + count_5 * 5
print(u)

Submission status: Accepted

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

    A = X // 500
    B = X % 500 // 5

    print(A * 1000 + B * 5)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
X = int(input())

ret = 0

ret += (X//500)*1000

X -= (X//500)*500

ret += (X//5)*5

print(ret)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
import math
from collections import defaultdict
n=int(sys.stdin.readline())
ans=0
a,b=n//500,n%500
five=b//5
ans=a*1000+five*5
print(ans)

Submission status: Accepted

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

print(happiness)

Submission status: Accepted

Solution code:
X = int(input())
num_500 = X // 500
X -= num_500 * 500
num_5 = X // 5

print(num_500*1000 + num_5*5)

Submission status: Accepted

Solution code:
N = int(input())

p = N // 500
q = N % 500

r = q // 5
s = q % 5

print(p*1000 + r*5)

Submission status: Accepted

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

Submission status: Accepted

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

x = X // 500
y = (X % 500) // 5

happy = x * 1000 + y * 5
print(happy)

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

Submission status: Accepted

Solution code:
X=int(input())

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

Submission status: Accepted

Solution code:
i = int(input())
five_h = i // 500
re_i = i % 500
five = re_i // 5
print(1000*five_h+5*five)

Submission status: Accepted

Solution code:
X=int(input())

r1=X//500
r2=(X-500*r1)//5
re=r1*1000+r2*5
print(re)

Submission status: Accepted

Solution code:
x = int(input())

n1 = x // 500
x = x % 500

n2 = x // 5
x = x % 5

print(1000 * n1 + 5 * n2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

y, z = divmod(X, 500)
temp = z // 5

print(y*1000+temp*5)

Submission status: Accepted

Solution code:
X = int(input())
result = 0
while X//500 != 0:
  X -= 500
  result += 1000
while X//5 != 0:
  X -= 5
  result += 5
print(result)

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
X = int(input().strip())

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0
num = x//500
ans += 1000*num

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

value = (x//500)*1000
remaining = x%500

temp_rem = (remaining//5)*5

print(value+temp_rem)

Submission status: Accepted

Solution code:
X = int(input())
m = X // 500
n = X % 500
o = n // 5

ans = 1000 * m + 5 * o
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

n = int(input())

n500 = n // 500

n = n % 500

n5 = n // 5

print(n500*1000+n5*5)

Submission status: Accepted

Solution code:
x = int(input())

v500 = x // 500

v5 = (x % 500) // 5

# print(v500)

# print(v5)

print(v500 * 1000 + v5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
ans = n // 500 * 1000

n %= 500
ans += n // 5 * 5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

ans = 0
temp = 0
ans = int(X/500) * 1000
temp = int(X%500)

ans = ans + int(temp/5) * 5
print(ans)

Submission status: Accepted

Solution code:
X = int(input())
big = X//500
Small = (X-500*big)//5

print(big*1000+ Small*5)

Submission status: Accepted

Solution code:
x = int(input())

num_500 = int(x//500)
num_5 = int((x-500*num_500)//5)

ans = 1000*num_500 + 5*num_5

print(ans)

Submission status: Accepted

Solution code:
if __name__ == "__main__":
    X = int(input())
    U = 0
    U += (X // 500) * 1000
    X = X % 500
    U += (X // 5) * 5

    print(U)

Submission status: Accepted

Solution code:
X = int(input())

if(X >= 500):
    ans = X//500*1000+((X-500*(X//500))//5)*5
    print(ans)
else:
    ans = (X//5)*5
    print(ans)

Submission status: Accepted

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

five_hundred = X // 500
five = (X % 500) // 5

print(five_hundred * 1000 + five * 5)

Submission status: Accepted

Solution code:
n = int(input())

n_500 = n//500
n_5 = (n-n_500*500)//5

res = n_500*1000 + n_5*5


print(res)

Submission status: Accepted

Solution code:
x = int(input())

n500, a500 = x // 500, x % 500
n5 = a500//5

print(n500*1000+n5*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())

ans = 0
# 余り
b = a % 500
# 商
c = int(a/500)

ans += c * 1000

d = int(b/5)

ans += d * 5

print(ans)

Submission status: Accepted

Solution code:
X = int(input())

def main(X):

    happy500 = X // 500
    mod_happy = X % 500
    happy5   = mod_happy // 5

    return happy500 * 1000 + happy5 * 5

if __name__ == "__main__":

    answer = main(X)
    print(answer)

Submission status: Accepted

Solution code:
X = int(input())

n_500, mod = divmod(X, 500)
n_5, mod = divmod(mod, 5)

print(n_500*1000 + n_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin, stdout


def read():
    x = stdin.readline().rstrip()
    return x


def __main__():

    q = int(read())

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

    print(a*1000 + c*5)

__main__()

Submission status: Accepted

Solution code:
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

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
for f in range(x//500+1):
    if(x - 500 >= 0):
        x -= 500
        ans += 1000
for g in range(x//5+1):
    if(x - 5 >= 0):
        x -= 5
        ans += 5
print(ans)

Submission status: Accepted

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

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

print(uresi)

Submission status: Accepted

Solution code:
x=int(input())
cnt1=0
cnt2=0
num500=x//500
num5=(x%500)//5
print(1000*num500+5*num5)

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

Submission status: Accepted

Solution code:
S=int(input())
A = S//500
a =S%500//5

print(A*1000 + a*5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

total = 0
total += (n // 500) * 1000
total += ((n%500) // 5) * 5
print(total)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

Solution code:
x=int(input())
num1=0
num2=0
while x>499:
  x=x-500
  num1+=1
while x>4:
  x=x-5
  num2+=1
print((1000*num1)+(5*num2))

Submission status: Accepted

Solution code:
x = int(input())

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

Submission status: Accepted

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

Submission status: Accepted

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


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

num=int(a/500)
ans=int(num*1000)
a-=num*500

num=int(a/5)
ans+=int(num*5)

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
ans = (n // 500) * 1000
ans += (n % 500) // 5 * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
s = int(input())
gohyaku = s//500
go=(s%500)//5

print(gohyaku*1000+go*5)

Submission status: Accepted

Solution code:
x = int(input())

t = x // 500

x_new = x - 500 * t 

t_2 = x_new // 5

print(1000*t + 5 * t_2)

Submission status: Accepted

Solution code:
n = int(input())
hap = 0

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

hap += 5 * (n // 5)
n %= 5

print(hap)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())
x_500, mod_500 = divmod(X, 500)
x_5, _ = divmod(X - x_500 * 500, 5)
print(x_500 * 1000 + x_5 * 5)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    resolve()

Submission status: Accepted

Solution code:
X = int(input())

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

print(res)

Submission status: Accepted

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

import sys


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


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

    num_500 = x // 500

    amari_500 = x % 500

    num_5 = amari_500 // 5

    ans = num_500 * 1000 + num_5 * 5

    print(ans)


if __name__ == "__main__":
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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


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

    q1, x = divmod(X, 500)
    q2 = x // 5

    print(q1 * 1000 + q2 * 5)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())

p500 = N//500 * 1000
p5 = N%500//5 * 5

print(p500 + p5)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

ans += (x//500)*1000

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

ans += (x//5)*5

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
n=int(input())
k=n//500
m=(n-k*500)//5
print(k*1000+5*m)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x = int(input())

fivehundled = x // 500
x = x - (500 * fivehundled)

five = x // 5
x = x - (5 * five)

happy = (fivehundled * 1000) + (five * 5)
print(happy)

Submission status: Accepted

Solution code:
X = int(input())

a = X // 500
X -= a * 500

b = X // 5

print( a * 1000 + b * 5 )

Submission status: Accepted

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

Submission status: Accepted

Solution code:
x=int(input())
y,mod=divmod(x, 500)
z,_=divmod(mod, 5)
print(y*1000+z*5)

Submission status: Accepted

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


def solve(X: int):
    n500 = X // 500
    n5 = (X - 500 * n500) // 5
    print(n500*1000 + n5 * 5)
    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:
def main():
    X = int(input())

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

    b = X // 5


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

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
x = int(input())

ans = 0

n = x // 500
x -= 500 * n
ans += n * 1000
n = x // 5
x -= 5 * n
ans += n * 5

print(ans)

Submission status: Accepted

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


while(1):
    if(x>=500):
        ure = ure+1000
        x = x-500
    elif(x>=5):
        ure = ure+5
        x = x-5
    else:
        break

print(ure)

Submission status: Accepted

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


##########
if __name__ == "__main__":
    b()

Submission status: Accepted

Solution code:
n = int(input())
n = n - (n % 5)

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

print(1000 * a + 5 * b)

Submission status: Accepted

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

X = int(input())
ans = 0
a,b = divmod(X,500)
ans += a*1000
c,d = divmod(b,5)
ans += c*5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

h = 1000 * (n // 500)

n -= 500 * (n // 500)

h += 5 * (n // 5)

print(h)

Submission status: Accepted

Solution code:
import sys

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

r1 = X // 500
r2 = (X - 500*r1) // 5

print(r1*1000 + r2*5)

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] = map(int, input().split())
q, mod = divmod(X, 500)
modq, mod = divmod(mod, 5)
print(q * 1000 + modq * 5)

Submission status: Accepted

Solution code:
X = int(input())


n500 = X // 500
x = X % 500

n5 = x // 5

print(n500*1000 + n5*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:
# coding: utf-8
X = int(input())
# print(X)

h = X // 500
f = (X - (500 * h)) // 5
# print(h, f)
ans = h * 1000 + f * 5
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X = int(input())

d, mod = divmod(X, 500)
e = mod // 5
print(d * 1000 + e * 5)

Submission status: Accepted

Solution code:
import numpy as np

X = int(input())

A = X // 500
B = X % 500
C = B // 5

print(1000 * A + C * 5)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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