Educational Codeforces Round 21 808A Lucky Year

来源:互联网 发布:cad2014软件多少钱 编辑:程序博客网 时间:2024/06/07 20:20

Educational Codeforces Round 21  808A Lucky Year 

A. Lucky Year
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345 are not.

You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year.

Input

The first line contains integer number n (1 ≤ n ≤ 109) — current year in Berland.

Output

Output amount of years from the current year to the next lucky one.

Examples
input
4
output
1


#include <stdio.h>#include <bits/stdc++.h>#define mod 1000000007typedef long long ll;using namespace std;ll n;int main(){ cin>>n;ll a=n,b=1;while(a){if(a<10){b*=a+1;break;} b=b*10;a/=10;}cout<<b-n;    return 0;} 


阅读全文
1 0
原创粉丝点击