CF488A.Giga Tower

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Giga Tower is the tallest and deepest building in Cyberland. There are 1777777777717777777777 floors, numbered from 8888888888-8888888888 to 88888888888888888888 . In particular, there is floor 00 between floor 1-1 and floor 11 . Every day, thousands of tourists come to this place to enjoy the wonderful view.

In Cyberland, it is believed that the number "8" is a lucky number (that's why Giga Tower has 88888888888888888888 floors above the ground), and, an integer is lucky, if and only if its decimal notation contains at least one digit "8". For example, 8,180,8088,-180,808 are all lucky while 42,1042,-10 are not. In the Giga Tower, if you write code at a floor with lucky floor number, good luck will always be with you (Well, this round is #278, also lucky, huh?).

Tourist Henry goes to the tower to seek good luck. Now he is at the floor numbered aa . He wants to find the minimum positive integer bb , such that, if he walks bb floors higher, he will arrive at a floor with a lucky number.

输入格式

The only line of input contains an integer aa ( 109<=a<=109-10^{9}<=a<=10^{9} ).

输出格式

Print the minimum bb in a line.

输入输出样例

  • 输入#1

    179
    

    输出#1

    1
    
  • 输入#2

    -1
    

    输出#2

    9
    
  • 输入#3

    18
    

    输出#3

    10
    

说明/提示

For the first sample, he has to arrive at the floor numbered 180180 .

For the second sample, he will arrive at 88 .

Note that bb should be positive, so the answer for the third sample is 1010 , not 00 .

首页