https://www.acmicpc.net/problem/2033
n=int(input()) t=1 num=n while n>9: a=n%10 if a>=5: num+=(10-a)*t n+=10 else: num-=a*t t*=10 n=int(n/10) print("%d"%num)