Giga Tower is the tallest and deepest building in Cyberland. There are 17 777 777 777 floors, numbered from  - 8 888 888 888 to 8 888 888 888. In particular, there is floor 0 between floor  - 1 and floor 1. 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 8 888 888 888 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, 808 are all lucky while 42,  - 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 a. He wants to find the minimum positive integer b, such that, if he walks b floors higher, he will arrive at a floor with a lucky number. 


-----Input-----

The only line of input contains an integer a ( - 10^9 ≤ a ≤ 10^9).


-----Output-----

Print the minimum b in a line.


-----Examples-----
Input
179

Output
1

Input
-1

Output
9

Input
18

Output
10



-----Note-----

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

For the second sample, he will arrive at 8.

Note that b should be positive, so the answer for the third sample is 10, not 0.

Source: codeforces | Difficulty: EASY
Tags: Complete search


Solutions:
floor = int(input())
floor += 1
count = 1
while '8' not in str(floor):
	floor += 1
	count += 1
print(count)


n = int(input())
step = 1
while '8' not in str(n + step):
	step += 1
print(step)


n = int(input())
c = 1
n += 1
while str(n).find('8') == -1:
	c += 1
	n += 1
print(c)


a = int(input())
for i in range(1, 20):
	if '8' in str(a + i):
		print(i)
		break


n = int(input())
count = 1
while True:
	n += 1
	if '8' in str(n):
		print(count)
		break
	count += 1


a = int(input().strip())
for i in range(1, 17):
	floor = str(a + i)
	if '8' in floor:
		print(i)
		break


n = int(input())
ans = 1
n += 1
while not str(n).count('8'):
	ans += 1
	n += 1
print(ans)


n = int(input())
b = 1
while not '8' in str(n + b):
	b += 1
print(b)


n = int(input())
for i in range(1, abs(8888888888 - n) + 1):
	if any((x == '8' for x in str(n + i))):
		print(i)
		exit(0)
print(-1)


n = int(input())
for i in range(1, 50):
	n += 1
	if '8' in list(str(n)):
		print(i)
		exit()


n = int(input())
v = 1
while True:
	if '8' in str(n + v):
		break
	else:
		v += 1
print(v)


def giga_tower(a_int: int) -> int:
	b_int = 1
	while True:
		number_int = a_int + b_int
		number_str = str(number_int)
		if '8' in number_str:
			return b_int
		else:
			b_int += 1
a = int(input())
print(giga_tower(a))


a = int(input())
b = a + 1
while '8' not in str(b):
	b += 1
print(b - a)


a = input()

def check(b):
	out = 0
	for i in range(0, len(b)):
		if b[i] == '8':
			out = 1
	return out
c = int(a)
c = c + 1
count = 1
while True:
	if check(str(c)) == 1:
		print(count)
		exit()
	else:
		count = count + 1
		c = c + 1


n = int(input())
for i in range(n + 1, 1000000000000):
	s = str(i)
	if s.count('8') != 0:
		print(i - n)
		return


def input_split(f):
	return map(f, input().split())

def main():
	a = int(input())
	c = 0
	c += 1
	a += 1
	while '8' not in str(a):
		c += 1
		a += 1
	print(c)
main()


n = int(input())
m = 1
while '8' not in str(n + m):
	m += 1
print(m)


def chk8(p):
	if p < 0:
		p *= -1
	while p >= 1:
		if p % 10 == 8:
			return True
		p /= 10
		p = int(p)
	return False
n = int(input())
for i in range(1, 20, 1):
	if chk8(i + n):
		print('%d\n' % i)
		break


import math

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans

def comb(n, c):
	return fact(n) // (fact(n - c) * c)
n = int(input())
ans = 0
for i in range(100):
	if '8' in str(n) and i != 0:
		break
	else:
		ans += 1
		n += 1
print(ans)


n = int(input())
count = 0
if '8' in str(n):
	n = n + 1
	count = count + 1
	while '8' not in str(n):
		count = count + 1
		n = n + 1
else:
	while '8' not in str(n):
		count = count + 1
		n = n + 1
print(count)


import math
n = int(input()) + 1
a = n - 1
while '8' not in str(n):
	n += 1
print(n - a)


x = int(input())
lucky = [i for i in range(x, x + 20) if '8' in str(i) and i != x]
minDif = 100
for i in lucky:
	if abs(i - x) < minDif:
		minDif = abs(i - x)
print(minDif)


def verifica_8(numero=''):
	for i in range(len(numero)):
		if numero[i] == '8':
			return True
	return False
entrada = int(input())
cont = 1
while True:
	numero = entrada + cont
	para = verifica_8(str(numero))
	if para == True:
		break
	cont += 1
print(cont)


n = int(input())
for i in range(1, 1000):
	if '8' in str(n + i):
		print(i)
		break


x = int(input())
b = 1
while not '8' in str(x + b):
	b += 1
print(b)


n = int(input())
c = 1
for i in range(n + 1, n + 100):
	x = list(str(i))
	if '8' in x:
		break
	c += 1
print(c)


def f(a):
	flag = False
	for i in str(a):
		if i == '8':
			flag = True
	return flag
a = int(input())
d = 1
while not f(a + d):
	d += 1
print(d)


n = 1
x = int(input()) + n
while '8' not in str(x):
	n += 1
	x += 1
print(n)


def check(k):
	k = str(k)
	return k.count('8') > 0
a = int(input())
ans = 1
while not check(a + ans):
	ans += 1
print(ans)


def lucky(b):
	if b < 0:
		b = -b
	while b > 0:
		if b % 10 == 8:
			return True
		b = b // 10
	return False
a = int(input())
b = a + 1
while not lucky(b):
	b += 1
print(b - a)


import re
from collections import Counter
from sys import stderr
from typing import Union, Generator, List, Tuple
import string
INF = 2e+18 + 3
EPS = 1e-10

def main():
	a = int(input())
	b = 1
	while '8' not in str(a + b):
		b += 1
	print(b)
main()


a = int(input())
b = 0
if '8' not in str(a):
	while '8' not in str(a):
		a += 1
		b += 1
	print(b)
else:
	a += 1
	b += 1
	while '8' not in str(a):
		a += 1
		b += 1
	print(b)


a = int(input())
s = a
g = 0
p = True
while p:
	s += 1
	g += 1
	if '8' in str(s):
		p = False
		break
print(g)


def main():

	def is_lucky(a):
		return len(list(filter(lambda i: i == '8', str(a)))) > 0
	a = int(input()) + 1
	b = 1
	while not is_lucky(a):
		a += 1
		b += 1
	return b
print(main())


def check(l):
	while l != 0:
		if l % 10 == 8:
			return True
		l = l // 10
n = int(input())
if -8 <= n <= -1:
	print(8 - n)
else:
	n += 1
	for i in range(1, 11):
		if check(abs(n)):
			print(i)
			break
		else:
			n += 1


(a,) = map(int, input().split())
ans = 1
while '8' not in str(a + ans):
	ans += 1
print(ans)


a = int(input())
u = a + 1
c = 0
while True:
	c += 1
	if '8' in set(str(u)):
		break
	u += 1
print(c)


n = int(input())
a = n
for i in range(1, 17):
	a += i
	s = str(a)
	if '8' in s:
		print(i)
		break
	a = n


n = int(input())
c = 18
for i in range(1, 17):
	m = n + i
	m = abs(m)
	while m > 0:
		k = m % 10
		if k == 8:
			c = min(c, i)
			break
		m //= 10
print(c)


n = input().strip()
j = 0
for i in range(30):
	j += 1
	n = str(int(n) + 1)
	if '8' in n:
		break
print(j)


a = int(input())
count = 1
a += 1
while '8' not in str(a):
	count += 1
	a += 1
print(count)


n = int(input())
if n == -8:
	print(16)
else:
	c = 0
	while True:
		c = c + 1
		n = n + 1
		if '8' in str(n):
			print(c)
			break


a = int(input())
a = str(a)
c = 0
for i in range(int(a) + 1, int(a) + 111):
	c += 1
	b = str(i)
	if '8' in b:
		break
print(c)


import sys
a = int(input())
for x in range(a + 1, 8888888888):
	if '8' in str(x):
		b = x
		break
print(b - a)
sys.exit()


n = int(input())
y = 0
if -8 <= n < -2:
	y = 17
else:
	y = 11
for i in range(1, y):
	x = n + i
	if '8' in str(x):
		print(i)
		break


n = int(input())
ans = int(1)
n += 1
while '8' not in str(n):
	n += 1
	ans += 1
print(ans)


n = int(input())
c = 1
for i in range(n + 1, 8888888888):
	if '8' in str(abs(i)):
		s = c
		break
	else:
		c += 1
print(s)


c = int(input())
a = c
while 1:
	a += 1
	s = str(a)
	if s.count('8'):
		print(a - c)
		break


s = input()
ans = 0
f = True
while f:
	s = str(int(s) + 1)
	ans += 1
	for i in s:
		if i == '8':
			f = False
print(ans)


import string
a = int(input())
b = 0

def ife(n):
	n = str(n)
	for x in range(len(n)):
		if n[x] == '8':
			return True
	return False
if ife(a):
	b += 1
	a += 1
while not ife(a):
	a += 1
	b += 1
print(b)


a = int(input(''))
count = 0

def check(m):
	if '8' in str(m):
		return True
	else:
		return False
while check(a) == False:
	a = a + 1
	count = count + 1
if count == 0:
	a = a + 1
	count = count + 1
	while check(a) == False:
		a = a + 1
		count = count + 1
print(count)


n = str(int(input()) + 1)
b = 1
while n.find('8') == -1:
	b += 1
	n = str(int(n) + 1)
print(b)


import sys
input = sys.stdin.readline
a = int(input())
cnt = 0
while True:
	a += 1
	cnt += 1
	a = str(a)
	if '8' in a:
		break
	else:
		a = int(a)
print(cnt)


A = int(eval(input()))
floor = 1
while True:
	if str(A + floor).count('8') > 0:
		break
	floor += 1
print(floor)


n = int(input())
for i in range(n + 1, n + 20):
	if str(i).count('8') > 0:
		print(i - n)
		break


def is_lucky(n):
	s = str(n)
	for i in range(len(s)):
		if s[i] == '8':
			return True
	return False
a = int(input())
step = 0
while a < 8888888888:
	if step is not 0 and is_lucky(a):
		break
	a += 1
	step += 1
print(step)


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list or type(n) is str:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return '\n'.join(map(str, arr))

def revn(n):
	return int(str(n)[::-1])

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True
n = ii()
t = n + 1
while '8' not in str(t):
	t += 1
print(t - n)


x = int(input())
for i in range(99):
	if '8' in str(x + i + 1):
		print(i + 1)
		break


floor = int(input())
c = 0
while '8' not in str(floor) or c == 0:
	floor += 1
	c += 1
print(c)


a = int(input())
for i in range(1, 17, 1):
	x = a + i
	aux = str(x)
	if aux.find('8') >= 0:
		sol = i
		break
print(sol)


import sys
floor_at = int(input())
for x in range(floor_at + 1, 8888888888):
	if '8' in str(x):
		print(x - floor_at)
		break


a = int(input())
(i, count) = (a, 0)
while i <= 8888888888:
	if '8' in str(i) and i != a:
		print(count)
		exit()
	else:
		i += 1
		count += 1


n = int(input())
ans = 0
while True:
	ans += 1
	n += 1
	if '8' in str(n):
		print(ans)
		exit()


Num = int(input(''))
count = 0
a = True
while a:
	Num = Num + 1
	count += 1
	nu = str(Num)
	if '8' in nu:
		a = False
print(count)


n = int(input())
now = n + 1
while 1:
	if '8' in str(now):
		print(now - n)
		break
	now += 1


n = int(input())
n += 1
s = str(n)
flag = False
su = 1
while flag == False:
	for char in s:
		if char == '8':
			print(su)
			exit(0)
	n += 1
	s = str(n)
	su += 1


n = input()
b = 1
while True:
	num = int(n) + b
	s = str(num)
	l = list(s)
	if '8' in s:
		break
	b += 1
print(b)


def nextLucky(n):
	if '8' in str(n):
		n += 1
		steps = 1
	else:
		steps = 0
	while '8' not in str(n):
		n += 1
		steps += 1
	return steps
print(nextLucky(int(input())))


piso = input()
pasos = 1
piso = str(int(piso) + 1)
while '8' not in piso:
	piso = str(int(piso) + 1)
	pasos += 1
print(pasos)


n = int(input())
floor = 0
while floor < 30:
	n += 1
	floor += 1
	if str(n).find('8') >= 0:
		print(floor)
		break


n = int(input())
n = str(n)
x = int(0)
while 1:
	x += 1
	n = str(int(n) + 1)
	if '8' in n:
		break
print(x)


a = int(input())
a += 1
f = 1
while str(a).count('8') == 0:
	a += 1
	f += 1
print(f)


(Answer, N) = (0, int(input()))
while True:
	(N, Answer) = (N + 1, Answer + 1)
	if '8' in str(N):
		print(Answer)
		exit()


def main():
	a = int(input())
	for b in range(1, 17):
		if '8' in str(a + b):
			print(b)
			return
main()


n = int(input(''))
x = n
c = '8'
s = 0
while s == 0:
	final = [each for each in c if each in str(n)]
	if len(final) > 0 and n - x > 0:
		s = 1
	n = n + 1
print(n - x - 1)


a = int(input())
b = 1
while not str(a + b).count('8'):
	b += 1
print(b)


def p(x):
	if '8' in x:
		return True
n = str(input())
for i in range(1, 17):
	if p(str(int(n) + i)) == True:
		print(i)
		break


n = int(input())
ans = 0
for i in range(16):
	n += 1
	ans += 1
	if str(n).find('8') != -1:
		print(ans)
		break


(n, b) = (int(input()), 1)
while True:
	a = n + b
	while a:
		if abs(a) % 10 == 8:
			print(b)
			exit()
		if a > 0:
			a //= 10
		else:
			a = -(abs(a) // 10)
	b += 1


n = int(input())
for i in range(1, 20):
	x = n + i
	if '8' in str(x):
		print(i)
		break


a = int(input())
c = 0
while 1:
	a = a + 1
	c = c + 1
	y = str(a)
	if '8' in y:
		break
print(c)


a = int(input())
l = []

def init(b):
	for i in range(len(b)):
		p = b[i]
		l.append(p)
	if '8' in l:
		return True
	else:
		return False
for i in range(1, 8888888888 - a):
	p = a + i
	k = str(p)
	if init(k) == True:
		print(i)
		break


s = input().strip()
c = 0
ans = ''.join(s)
ans = int(ans)
ans += 1
ans = str(ans)
ans = list(ans)
l = ans
c += 1
while True:
	if '8' in l:
		break
	ans = ''.join(l)
	ans = int(ans)
	ans += 1
	ans = str(ans)
	ans = list(ans)
	l = ans
	c += 1
print(c)


a = int(input())
b = 1

def check8(n):
	c = 0
	n = str(n)
	for char in n:
		if char == '8':
			c = 1
	return c
n = a + 1
while check8(n) == 0:
	b += 1
	n += 1
print(b)


limit = 8888888888
num = int(input())
temp = num
b = 0
while num <= limit:
	numlist = list(str(num))
	if '8' in numlist and num != temp:
		break
	b += 1
	num += 1
print(b)


s = int(input())
p = s + 1
while str(p).find('8') < 0:
	p += 1
print(p - s)


def steps(x):
	piso = x
	while True:
		piso += 1
		if '8' in str(piso):
			break
	return piso - x
print(steps(int(input())))


a = int(input())
f = lambda x: x if '8' in str(x) else f(x + 1)
print(f(a + 1) - a)


n = int(input()) + 1
c = 1
while '8' not in str(n):
	n += 1
	c += 1
print(c)


n = int(input())
n += 1
s = str(n)
flag = False
su = 1
while flag == False:
	for char in s:
		if char == '8':
			print(su)
			return
	n += 1
	s = str(n)
	su += 1


n = 1
s = int(input()) + n
while '8' not in str(s):
	n += 1
	s += 1
print(n)


r = int(input())

def fe(x):
	return '8' in list(str(x))
x = r
r += 1
while 1:
	if fe(r):
		print(r - x)
		break
	r += 1


n = int(input())
n += 1
foo = 1
while True:
	for i in str(n):
		if i == '8':
			print(foo)
			exit()
	n += 1
	foo += 1


n = int(input())
r = 1
while '8' not in str(n + r):
	r += 1
print(r)


n = int(input())
j = 0
k = 0
while k == 0:
	if str(n).count('8') > 0 and j > 0:
		k = 1
	else:
		j += 1
		n += 1
print(j)


x = int(input())
k = 0
for i in range(x + 1, 8888888888):
	if '8' in str(i):
		k += 1
		q = i - x
		print(q)
		break


n = int(input())
b = 0
s = ''
while '8' not in s:
	n = n + 1
	b = b + 1
	s = str(n)
print(b)


n = int(input())
t = 1
while str(n + t).count('8') == 0:
	t += 1
print(t)


n = int(input())
n += 1
ans = 0
_ = True
while _:
	s = str(n)
	for i in s:
		try:
			if int(i) == 8:
				_ = False
				break
		except:
			continue
	ans += 1
	n += 1
print(ans)


n = int(input())
cnt = 1
n += 1
while 1:
	sn = str(n)
	f = 0
	for i in sn:
		if i == '8':
			f = 1
	if f == 1:
		print(cnt)
		break
	n += 1
	cnt += 1


n = int(input())
b = 1
while 1:
	n += 1
	n = str(n)
	if '8' in n:
		print(b)
		break
	n = int(n)
	b += 1


n = int(input())
c = 0
for i in range(20):
	f = 0
	n = n + 1
	c = c + 1
	a = str(n)
	for j in a:
		if j == '8':
			f = 1
	if f == 1:
		print(c)
		break


def islucky(num):
	num = abs(num)
	while num > 0:
		if num % 10 == 8:
			return True
		num = int(num / 10)
	return False
n = 1
num = int(input())
while True:
	if islucky(num + n):
		print(n)
		break
	n += 1


a = int(input())
t = 0
if '8' in str(a):
	a += 1
	t += 1
while '8' not in str(a):
	a += 1
	t += 1
print(t)


(a, b) = (int(input()), 1)
while str(a + b).find('8') == -1:
	b += 1
print(b)


n = int(input())
i = 1
while True:
	n += 1
	s = str(n)
	if '8' in s:
		print(i)
		exit()
	i += 1


n = int(input())
for i in range(1, 21):
	check = set(str(n + i))
	if '8' in check:
		print(i)
		break


i = int(input())
k = 0
for j in range(1, 100):
	if '8' in str(i + j):
		k = j
		break
print(k)


num = int(input())
i = 0
while '8' not in str(num + 1):
	num += 1
	i += 1
print(i + 1)


from collections import deque, Counter
from itertools import combinations, permutations
from math import sqrt
import unittest

def read_int():
	return int(input().strip())

def read_int_array():
	return [int(i) for i in input().strip().split(' ')]
n = read_int()
count = 0
while True:
	n += 1
	count += 1
	if '8' in str(n):
		break
print(count)


from sys import stdin

def ocho(numero):
	prueba = str(numero)
	return prueba.find('8')
n = int(stdin.readline())
contador = 0
flag = True
while flag:
	contador += 1
	n += 1
	if ocho(n) >= 0:
		flag = False
print(contador)


z = int(input())
b = z
for i in range(1, 100):
	b += 1
	if '8' in str(b):
		print(b - z)
		break


import sys
a = int(input())
p = 0
if a == 0:
	print(8)
	sys.exit()
while True:
	a += 1
	p += 1
	j = abs(a)
	while j != 0:
		if j % 10 == 8:
			print(p)
			sys.exit()
		else:
			j = j // 10


n = input()
if '8' in n:
	a = n.count('8')
	A = 0
	while '8' not in n or A == 0:
		n = str(int(n) + 1)
		A += 1
	print(A)
else:
	n = int(n)
	A = 0
	while '8' not in str(n):
		n += 1
		A += 1
	print(A)


n = int(input())
cnt = 1
while '8' not in str(n + cnt):
	cnt += 1
print(cnt)


n = int(input())
c = 0
for i in range(n + 1, 8888888889):
	x = i
	c = c + 1
	while x != 0:
		if x < 0:
			m = -x % 10
		else:
			m = x % 10
		if m == 8:
			break
		x = int(x / 10)
	if x != 0:
		break
print(c)


n = int(input())
ans = 0
n += 1
while True:
	lis = set(str(abs(n)))
	ans += 1
	if '8' in lis:
		break
	n += 1
print(ans)


a = int(input())
c = 0
for i in range(a + 1, 8888888889):
	c += 1
	if '8' in str(i):
		print(c)
		break


s = str(int(input()) + 1)
ans = 1
while '8' not in s:
	ans += 1
	s = str(int(s) + 1)
print(ans)


n = int(input())
a = 0
while True:
	a += 1
	n += 1
	string = str(n)
	if '8' in string:
		break
print(a)


a = int(input())
s1 = str(a)
(count, flag) = (0, 0)
while flag == 0:
	count += 1
	a = int(s1)
	a = a + 1
	s1 = str(a)
	if '8' in s1:
		print(count)
		flag = 1


n = int(input())
moves = 0
while '8' not in str(n + 1):
	moves += 1
	n += 1
print(moves + 1)


def contains_Eight(num):
	return True if '8' in str(num) else False
n = int(input())
for i in range(1, 17):
	n += 1
	if contains_Eight(n):
		print(i)
		break


def lucky(n):
	if n < 0:
		n *= -1
	res = False
	while n > 0:
		if n % 10 == 8:
			return True
		n //= 10
	return False
a = int(input()) + 1
cnt = 0
while not lucky(a):
	cnt += 1
	a += 1
print(cnt + 1)


def check8(num):
	num = str(num)
	for i in num:
		if i == '8':
			return True
a = int(input())
x = a
a = a + 1
while True:
	if check8(a):
		print(a - x)
		break
	a += 1


a = int(input())
i = 0
while 1:
	a += 1
	i += 1
	b = str(a)
	if b.count('8') > 0:
		print(i)
		break


def check_if_eight(number):
	temp = abs(number)
	count = 0
	while temp > 0:
		i = int(temp) % 10
		if i == 8:
			return True
			break
		else:
			count += 1
		temp /= 10
	return False

def main():
	a = int(input())
	temp = a
	count = 0
	while temp == a or not check_if_eight(a):
		a += 1
		count += 1
	print(count)
main()


v = 1
s = int(input())
while True:
	s = s + 1
	if str(s).find('8') > -1:
		break
	v = v + 1
print(str(v))


def In8(A):
	if '8' in str(A):
		return True
	return False
A = int(input())
Output = 0
if In8(A):
	A += 1
	Output += 1

def Main(A):
	for I in range(8888888888 - A):
		if In8(A + I):
			return I
Output += Main(A)
print(Output)


a = int(input())
b = 0
while True:
	if str(a).find('8') > -1 and b != 0:
		print(b)
		break
	a += 1
	b += 1


a = int(input()) + 1
steps = 1
while str(a).find('8') == -1:
	a += 1
	steps += 1
print(steps)


__author__ = 'Daniil'
a = int(input())
for i in range(a + 1, a + 100):
	if '8' in str(i):
		print(i - a)
		break


n = int(input())
for i in range(n + 1, 8888888889):
	a = list(str(i))
	if '8' not in a:
		continue
	else:
		print(abs(n + 1 - i) + 1)
		exit(0)


a = int(input())
ans = 1
a += 1
while '8' not in str(a):
	ans += 1
	a += 1
print(ans)


v = int(input())
c = 1
v += 1
while '8' not in str(v):
	v += 1
	c += 1
print(c)


from collections import Counter
n = int(input())
n += 1
b = 1
while '8' not in str(n):
	n += 1
	b += 1
print(b)


n = int(input())
c = 0
for i in range(17):
	n += 1
	c += 1
	if '8' in str(n):
		print(c)
		break


n = int(input())
for i in range(1, 100):
	if str(n + i).find('8') != -1:
		print(i)
		exit(0)


s = input()
e = 0
if '8' in s:
	s = str(int(s) + 1)
	e = 1
while True:
	if '8' in s:
		break
	s = str(int(s) + 1)
	e += 1
print(e)


a = int(input())
x = 0
while True:
	a += 1
	x += 1
	if '8' in str(a):
		print(x)
		quit()


n = int(input())
ans = 0

def check(k):
	global n
	if k == n:
		return False
	k = str(k)
	for i in k:
		if i == '8':
			return True
	return False
a = n
while not check(a):
	a += 1
	ans += 1
print(ans)


x = int(input())
(a, count) = (x, 0)
while True:
	a = a + 1
	a = str(a)
	List = list(a)
	count = count + 1
	if List.count('8') != 0:
		print(count)
		exit()
	a = int(a)


n = int(input())
count = 0
for i in range(1, 21):
	s = n + i
	s = str(s)
	l = list(s)
	count += 1
	if '8' in l:
		print(count)
		break


a = int(input())
i = 0
a += 1
while '8' not in str(a + i):
	i += 1
print(i + 1)


a = int(input())

def check(c):
	l = len(c)
	i = l - 1
	while i >= 0 and c[i] != '8':
		i -= 1
	if i != -1:
		return True
	else:
		return False
b = 1
while not check(str(a + b)):
	b += 1
print(b)


def test(a):
	for c in str(a):
		if c == '8':
			return True
	return False
a = int(input())
b = 0
while True:
	a += 1
	b += 1
	if test(a):
		break
print(b)


n = int(input())
y = 0
for x in range(555555):
	y += 1
	if '8' in list(str(n + y)):
		print(y)
		break


y = int(input())
i = 1
while True:
	x = y
	x += i
	if '8' in list(str(x)):
		break
	i += 1
print(i)


x = int(input())
count = 0
while '8' not in str(x) or count == 0:
	x += 1
	count += 1
print(count)


a = int(input())
i = 1
while 1 == 1:
	if str(a + i).find('8') != -1:
		break
	i = i + 1
print(i)


ins = int(input()) + 1
count = 1
while '8' not in str(ins):
	ins += 1
	count += 1
print(count)


def main():
	a = int(input())
	for i in range(1, 17):
		if '8' in str(a + i):
			print(i)
			break
main()


n = int(input())
sw = 0
h = 0
while True:
	n += 1
	h += 1
	t = abs(n)
	while t:
		if t % 10 == 8:
			sw = 1
			break
		t //= 10
	if sw:
		break
print(h)


import sys
x = int(input())
for i in range(1, 17):
	buffer = x + i
	array = list(str(buffer))
	if '8' in array:
		print(i)
		sys.exit()


import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__

def has8(num):
	num = abs(num)
	while num > 0:
		if num % 10 == 8:
			return True
		num = int(num / 10)
	return False
n = int(input())
done = False
curr = n + 1
while True:
	if has8(curr):
		break
	curr = curr + 1
print(curr - n)


a = int(input())
for i in range(1, 100):
	if -1 != str(a + i).find('8'):
		print(i)
		break


s = int(input()) + 1
c = 1
while str(s).count('8') < 1:
	s = s + 1
	c = c + 1
print(c)


__author__ = 'Rakshak.R.Hegde'
a = int(input())
i = a + 1
while True:
	if '8' in str(i):
		break
	i += 1
print(i - a)


import time
a = input()
start = time.time()
ans = 1
a = str(int(a) + 1)
while '8' not in a:
	a = str(int(a) + 1)
	ans += 1
print(ans)
finish = time.time()


N = int(input())
i = N + 1
while '8' not in str(i):
	i += 1
print(i - N)


a = int(input())
if a > 0 or a <= -9:
	for i in range(a, 10000000000000000000000):
		k = i + 1
		k = str(k)
		if '8' in k:
			k = int(k)
			print(k - a)
			break
		else:
			continue
elif -9 < a <= 0:
	print(8 - a)


n = int(input())
for i in range(1, 21):
	n1 = n + i
	if '8' in str(n1):
		print(i)
		exit()


n = int(input(''))
j = n + 1
while '8' not in str(j):
	j = j + 1
print(j - n)


n = int(input())
t = 0
for i in range(n + 1, 8888888889):
	if '8' in str(i):
		t = i
		break
print(t - n)


x = input()
aux = 0
while True:
	if '8' in x:
		if aux == 0:
			aux += 1
			x = str(int(x) + 1)
		else:
			break
	else:
		x = str(int(x) + 1)
		aux += 1
print(aux)


import sys

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

def get_ints():
	return map(int, sys.stdin.readline().strip().split())

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

def check(string):
	for i in string:
		if i == '8':
			return True
	return False
n = int(input())
up = 1
while True:
	if check(str(n + up)):
		break
	up += 1
print(up)


a = int(input())
for b in range(1, 100):
	if '8' in str(a + b):
		print(b)
		break


i = int(input())
j = i + 1

def check_8(i):
	s = str(i)
	for c in s:
		if c == '8':
			return True
	return False
while not check_8(j):
	j += 1
print(j - i)


import sys
for n in sys.stdin:
	n = int(n)
	m = n
	n += 1
	while '8' not in str(n):
		n += 1
	print(n - m)


n = int(input())
p = n + 1
flag = False
while flag != True:
	p = str(p)
	d = {}
	for char in p:
		if char == '8':
			d['8'] = d.get('8', 0) + 1
	if d.get('8', 0) != 0 and flag == False:
		num = int(p)
		flag = True
	else:
		p = int(p)
		p += 1
print(int(p) - int(n))


a = int(input())
b = 0
while '8' not in str(a) or b == 0:
	a += 1
	b += 1
print(b)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def inp():
	return stdin.readline().strip()

def iinp():
	return int(inp())

def out(var, end='\n'):
	stdout.write(str(var) + '\n')

def outa(*var, end='\n'):
	stdout.write(' '.join(map(str, var)) + end)

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(m, val) for j in range(n)]

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
s = inp()
flg = False
c = 1
s = str(int(s) + 1)
while not flg:
	if '8' in s:
		break
	s = str(int(s) + 1)
	c += 1
print(c)


a = int(input())
for i in range(1, 101):
	if str(a + i).count('8'):
		print(i)
		break


n = int(input())
ans = 0
if '8' in str(n):
	ans += 1
	n += 1
while not '8' in str(n):
	n += 1
	ans += 1
print(ans)


n = int(input())

def iflucky(n):
	k = str(n)
	for i in k:
		if i == '8':
			return True
	else:
		return False
count = 1
while True:
	n += 1
	z = iflucky(n)
	if z is True:
		print(count)
		break
	else:
		count += 1


def containEight(a):
	if a < 0:
		a = -a
	while a > 0:
		rem = a % 10
		if rem == 8:
			return True
		a //= 10
	return False
a = int(input())
for i in range(1, 20):
	if containEight(a + i):
		print(i)
		exit()


a = input()
c = 0
flag = 1
while flag == 1:
	a = str(int(a) + 1)
	c += 1
	if '8' in a:
		flag = 0
print(c)


a = int(input())
if '8' in str(a):
	for j in range(1, 17777777777):
		a += 1
		if '8' in str(a):
			print(j)
			break
else:
	for j in range(1, 17777777777):
		a += 1
		if '8' in str(a):
			print(j)
			break


from sys import stdin, stdout
s = stdin.readline()
i = 1
s = int(s)
while '8' not in str(s + i):
	i += 1
stdout.write(str(i))


n = int(input())
a = 0
m = n
if '8' in list(str(n)) and a != 0:
	print(0)
elif n < 0 and 0 - n <= 10:
	d = 0 - n
	n = 0
	while True:
		n = n + a
		if '8' in list(str(n)) and a != 0:
			print(a + d + 1)
			break
		else:
			a += 1
elif n < 0 and 0 - n > 10:
	while True:
		n = m + a
		if '8' in list(str(abs(n))) and a != 0:
			print(a)
			break
		else:
			a += 1
else:
	while True:
		n = m + a
		if '8' in list(str(n)) and a > 0:
			print(a)
			break
		else:
			a += 1


cur = int(input()) + 1
steps = 1
while not '8' in str(cur):
	cur += 1
	steps += 1
print(steps)


n = int(input())
count = 1
while '8' not in str(n + count):
	count += 1
print(count)


a = int(input())
i = 1
a += 1
while a < 8888888888 and (not '8' in str(a)):
	a += 1
	i += 1
print(i)


n = int(input())
c = 1
if c == 1:
	d = str(n)
	for i in range(1, 100):
		n = n + 1
		n = str(n)
		if str(n).count('8') > 0:
			print(int(n) - int(d))
			c = 0
			break
		n = int(n)


N = int(input())
ans = 1
while True:
	if '8' in str(N + ans):
		print(ans)
		exit()
	ans += 1


a = int(input())

def isLucky(n):
	s = str(n)
	flag = 0
	for i in range(0, len(s)):
		if s[i] == '8':
			flag = 1
	if flag == 1:
		return 'yes'
	else:
		return 'no'
f = []
for i in range(1, 17, 1):
	b = a + i
	if isLucky(b) == 'yes':
		f.append(i)
print(min(f))


n = k = int(input()) + 1
while not '8' in str(k):
	k += 1
print(k - n + 1)


n = int(input())
b = 0
for i in range(n + 1, 10000000000):
	if '8' in str(i):
		print(int(i) - n)
		break


from sys import stdin, stdout, stderr, setrecursionlimit
setrecursionlimit(100000)

def debug(*e):
	if not __debug__:
		print(*e, file=stderr)

def dd(*vals):
	import inspect, re
	frame = inspect.getframeinfo(inspect.stack()[1][0])
	vs = re.search('dd\\((.+)\\)', frame.code_context[0]).group(1).split(',')
	if vs:
		debug(','.join(('{0} = {1}'.format(vs[i], v) for (i, v) in enumerate(vals))))

def trace(f):

	def traced(*args, **kw):
		debug('calling {} with args {}, {}'.format(f.__name__, args, kw))
		return f(*args, **kw)
	return traced

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

def readarr(sep=None, maxsplit=-1):
	return read().split(sep, maxsplit)

def readint():
	return int(read())

def readia(sep=None, maxsplit=-1):
	return [int(a) for a in readarr(sep, maxsplit)]

def write(*args, **kwargs):
	sep = kwargs.get('sep', ' ')
	end = kwargs.get('end', '\n')
	stdout.write(sep.join((str(a) for a in args)) + end)

def writea(arr, sep=' ', end='\n'):
	stdout.write(sep.join((str(a) for a in arr)) + end)
a = readint()
s = str(a)
b = -1
last = a % 10

def pos():
	import re
	if re.findall('.*7.*9+', s):
		return 1
	elif re.findall('.*8.*..$', s):
		return 1
	elif s[:-2] == '89':
		return 9
	elif a > 0 and last < 8:
		return 8 - last
	else:
		return -1
if a > 0:
	b = pos()
if b == -1:
	for i in range(a + 1, 8888888889):
		if str(i).rfind('8') > -1:
			b = abs(a - i)
			break
write(b)


x = int(input())
cont = 1
x += 1
while not '8' in str(x):
	x += 1
	cont += 1
print(cont)


k = int(input())
b = 0
while k <= 8888888888:
	if str(k).count(str(8)) >= 1 and b != 0:
		break
	k = k + 1
	b += 1
print(b)


n = input()
cnt = 0
while n.count('8') == 0 or cnt == 0:
	cnt += 1
	n = str(int(n) + 1)
print(cnt)


n = int(input())
c = 1
n += 1
while 1:
	if '8' in str(n):
		break
	n += 1
	c += 1
print(c)


floor = int(input())
c_floor = floor + 1
while c_floor <= 8888888888:
	if '8' in str(c_floor):
		break
	c_floor += 1
print(c_floor - floor)


s = int(input())
counter = 0
for i in range(s + 1, s + 21):
	tmp = str(i)
	counter += 1
	if '8' in tmp:
		break
print(counter)


s = input()
n = int(s)
for i in range(n + 1, 8888888889):
	s1 = str(i)
	if '8' in s1:
		print(i - n)
		exit(0)


a = int(input())
i = 1
while 1:
	b = str(a + i)
	if '8' in b:
		print(i)
		break
	i += 1


a = int(input())
a += 1
x = 1
while str(a).count('8') == 0:
	a += 1
	x += 1
print(x)


def solve(x):
	for i in str(x):
		if i == '8':
			return True
	return False
t = int(input())
s = str(t)
if '8' in s:
	t += 1
	count = 1
	while not solve(t):
		count += 1
		t += 1
	print(count)
else:
	count = 0
	while not solve(t):
		count += 1
		t += 1
	print(count)


class CodeforcesTask488ASolution:

	def __init__(self):
		self.result = ''
		self.a = 0

	def read_input(self):
		self.a = int(input())

	def process_task(self):
		steps = 1
		while not '8' in str(self.a + steps):
			steps += 1
		self.result = str(steps)

	def get_result(self):
		return self.result
Solution = CodeforcesTask488ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
if -8 <= n <= 7:
	print(8 - n)
elif n >= 8:
	n += 1
	temp = list(str(n))
	if temp.count('8') > 0:
		print(1)
	elif temp[len(temp) - 1] == '9':
		carry = 1
		temp.insert(0, '0')
		i = len(temp) - 1
		while i >= 0:
			if temp[i] == '9':
				temp[i] = '0'
			else:
				temp[i] = str(int(temp[i]) + carry)
				break
			i -= 1
		if temp[0] == '0':
			temp.pop(0)
		if temp.count('8') == 0:
			temp[len(temp) - 1] = '8'
		ans = int(''.join(temp))
		print(ans - n + 1)
	else:
		temp[len(temp) - 1] = '8'
		ans = int(''.join(temp))
		print(ans - n + 1)
else:
	n = abs(n)
	n -= 1
	temp = list(str(n))
	if temp.count('8') > 0:
		print(1)
	elif temp[len(temp) - 1] == '9':
		print(2)
	else:
		i = len(temp) - 2
		while i >= 0:
			if temp[i] == '0':
				temp[i] = '9'
			else:
				temp[i] = str(int(temp[i]) - 1)
				break
			i -= 1
		if temp[0] == '0':
			temp.pop(0)
		if temp.count('8') == 0:
			temp[len(temp) - 1] = '8'
		ans = int(''.join(temp))
		for i in range(1, 11):
			ans += 1
			if str(ans).count('8') == 0:
				ans -= 1
				result = True
				break
		print(n - ans + 1)


n = int(input())
res = 0
for i in range(16):
	n += 1
	res += 1
	if str(n).find('8') != -1:
		print(res)
		exit()


import os
import sys
from io import BytesIO, IOBase
import math as M
import itertools as ITR
from collections import defaultdict as D
from collections import Counter as C
from collections import deque as Q
import threading
from functools import lru_cache, reduce
from functools import cmp_to_key as CMP
from bisect import bisect_left as BL
from bisect import bisect_right as BR
import random as R
import string
import cmath, time
enum = enumerate
start_time = time.time()
MOD = 1000000007
MA = float('inf')
MI = float('-inf')
di8 = ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1))
di4 = ((1, 0), (0, 1), (-1, 0), (0, -1))

def increase_stack():
	sys.setrecursionlimit(2 ** 32 // 2 - 1)
	threading.stack_size(1 << 27)

def binary(n):
	return bin(n)[2:]

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def maxfactor(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
	if q:
		return q[-1]

def factors(n):
	q = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			q.append(i)
			q.append(n // i)
	return list(sorted(list(set(q))))

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	l.sort()
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def seive(n):
	a = []
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p ** 2, n + 1, p):
				prime[i] = False
		p = p + 1
	for p in range(2, n + 1):
		if prime[p]:
			a.append(p)
	prime[0] = prime[1] = False
	return (a, prime)

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(M.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countchar(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def str_counter(a):
	q = [0] * 26
	for i in range(len(a)):
		q[ord(a[i]) - 97] = q[ord(a[i]) - 97] + 1
	return q

def lis(arr):
	n = len(arr)
	lis = [1] * n
	maximum = 0
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
				maximum = max(maximum, lis[i])
	return maximum

def gcd(a, b):
	if b == 0:
		return a
	else:
		return gcd(b, a % b)

def agcd(a, *b):
	for i in b:
		a = gcd(a, i)
	return a

def lcm(a, *b):
	val = a
	gc = a
	for i in b:
		gc = gcd(gc, i)
		val *= i
	return val // gc

def ncr(n, r):
	return M.factorial(n) // (M.factorial(n - r) * M.factorial(r))

def npr(n, r):
	return M.factorial(n) // M.factorial(n - r)

def IF(c, t, f):
	return t if c else f

def YES(c):
	print(IF(c, 'YES', 'NO'))

def Yes(c):
	print(IF(c, 'Yes', 'No'))

def yes(c):
	print(IF(c, 'yes', 'no'))

def JA(a, sep=' '):
	print(sep.join(map(str, a)))

def JAA(a, s='\n', t=' '):
	return s.join((t.join(map(str, b)) for b in a))

def PS(a, s=' '):
	print(str(a), end=s)

def I():
	return int(inp())

def F():
	return float(inp())

def LI():
	return list(map(int, inp().split()))

def LF():
	return list(map(float, inp().split()))

def MATI(n):
	return [LI() for i in range(n)]

def MATS(n):
	return [list(inp()) for i in range(n)]

def IV():
	return map(int, inp().split())

def FV():
	return map(float, inp().split())

def LS():
	return list(inp())

def S():
	return inp()
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
inp = lambda : sys.stdin.readline().rstrip('\r\n')
TestCases = 0

def solve():
	n = I()
	c = 0
	while True:
		c += 1
		n += 1
		if '8' in str(n):
			break
	print(c)

def main():
	flag = 1
	try:
		sys.stdin = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/input.txt', 'r')
		sys.stdout = open('c:/Users/Manoj Chowdary/Documents/python/CodeForces/contest-div-2/output.txt', 'w')
	except:
		flag = 0
	t = 1
	if TestCases:
		t = I()
	for _ in range(1, t + 1):
		solve()
	if flag:
		print('Time: %.4f sec' % (time.time() - start_time))
		localtime = time.asctime(time.localtime(time.time()))
		print(localtime)
		sys.stdout.close()
main()


a = int(input())
b = 1
while True:
	a += 1
	if '8' in repr(a):
		break
	else:
		b += 1
print(b)


def c(n):
	n1 = n
	n1 = abs(n1)
	for i in range(10):
		if n1 % 10 == 8:
			return 1
		n1 = n1 // 10
	return 0
n = int(input())
r = 1
while not c(n + r):
	r = r + 1
print(r)


number = int(input())
i = 1
while True:
	number += 1
	if '8' in str(number):
		break
	else:
		i += 1
print(i)


a = int(input())
b = 0
while True:
	a += 1
	b += 1
	if '8' in str(a):
		break
print(b)


def isLuck(a):
	if str(a).count('8') > 0:
		return True
	else:
		return False
a = int(input())
for i in range(1, 100):
	if isLuck(a + i):
		print(i)
		exit()


def f(x):
	if x.count('8'):
		return True
	return False
a = int(input())
c = 1
a += 1
a = str(a)
while not f(a):
	a = str(int(a) + 1)
	c += 1
print(c)


a = int(input())
c = 0
while 1:
	a = a + 1
	c = c + 1
	if str(a).find('8') != -1:
		break
print(c)


a = int(input())
b = a + 1
while str(b).count('8') == 0:
	b += 1
print(b - a)


n = input()
floor = 0
if n.count('8') >= 1:
	n = str(1 + int(n))
	while True:
		if n.count('8') >= 1:
			floor += 1
			break
		else:
			floor += 1
			n = str(1 + int(n))
else:
	while True:
		if n.count('8') == 1:
			break
		else:
			floor += 1
			n = str(1 + int(n))
print(floor)


from sys import stdin
stdin.readline

def mp():
	return map(int, input().split())

def it():
	return int(input())
n = it()
ans = 0
while 1:
	n += 1
	ans += 1
	if '8' in str(n):
		break
print(ans)


def check(a):
	strno = str(a)
	for no in strno:
		if no == '8':
			return 1
	return 0
a = input()
i = 1
while i < 100:
	if check(int(a) + i) == 1:
		print(i, '\n')
		break
	else:
		i = i + 1


i = int(input())
i += 1
i = str(i)
ret = 1
while '8' not in i:
	i = int(i)
	i += 1
	i = str(i)
	ret += 1
print(ret)


a = int(input())
res = 1
a += 1
while '8' not in str(a):
	res += 1
	a += 1
print(res)


def contain8(c):
	if c < 0:
		c = -c
	while c > 0:
		d = c % 10
		if d == 8:
			return True
		c = c // 10
	return False
a = int(input())
b = 1
found = False
while not found:
	a += 1
	if contain8(a):
		break
	b += 1
print(b)


a = int(input())
b = 0
flag = False
while True:
	a += 1
	b += 1
	for i in range(len(str(a))):
		if str(a)[i] == '8':
			flag = True
	if flag:
		break
print(b)


n = int(input())

def tower(n):
	count = 1
	x = str(n)
	while '8' not in str(n + 1):
		n += 1
		count += 1
	return count
print(tower(n))


a = input()
b = int(a)
ok = False
while ok == False:
	a = str(int(a) + 1)
	for j in range(len(a)):
		if a[j] == '8':
			ok = True
			break
print(int(a) - b)


x = int(input()) + 1
c = 1

def has_eight(x):
	return '8' in str(x)
while not has_eight(x):
	x += 1
	c += 1
print(c)


a = int(input())
a += 1
c = 1
while not '8' in str(a):
	a += 1
	c += 1
print(c)


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
readint = lambda : int(sys.stdin.readline().rstrip('\r\n'))
readints = lambda : map(int, sys.stdin.readline().rstrip('\r\n').split())
readstr = lambda : sys.stdin.readline().rstrip('\r\n')
readstrs = lambda : map(str, sys.stdin.readline().rstrip('\r\n').split())
readarri = lambda : [int(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]
readarrs = lambda : [str(_) for _ in sys.stdin.readline().rstrip('\r\n').split()]

def solve():
	n = readint()
	orig = n
	while 1:
		n += 1
		if '8' in str(n):
			print(n - orig)
			return

def main():
	t = 1
	for _ in range(t):
		solve()
main()


n = int(input())
for i in range(1, 100):
	m = n + i
	if '8' in str(m):
		print(i)
		break


n = int(input())
b = 0
while True:
	n += 1
	b += 1
	digits = list(map(int, list(str(abs(n)))))
	if 8 in digits:
		print(b)
		break


n = int(input())
l = []
for i in range(1, 1001):
	l.append(n + i)
for i in range(0, len(l)):
	l[i] = str(l[i])
	if '8' in l[i]:
		print(i + 1)
		break


n = int(input())
a = 1
while '8' not in str(n + a):
	a = a + 1
print(a)


(n, ans) = (int(input()), 0)
for i in range(n, 8888888888):
	s = str(i)
	if '8' in s and ans != 0:
		print(ans)
		exit()
	else:
		ans += 1


def s(g):
	g = str(g)
	k = list(g)
	if '8' in k:
		return False
	return True
mode = 'fiadasdle'
if mode == 'file':
	f = open('test.txt', 'r')
if mode == 'file':
	n = int(f.readline())
else:
	n = int(input())
b = n + 1
while s(b):
	b += 1
print(b - n)
if mode == 'file':
	f.close()


def ok(i):
	i = abs(i)
	while i > 0:
		if i % 10 == 8:
			return True
		i //= 10
	return False
n = int(input())
b = 1
while not ok(n + b):
	b += 1
print(b)


inp = input()
x = int(inp)
count = 0
while True:
	x = x + 1
	count = count + 1
	st = str(x)
	if '8' in st:
		break
print(count)


def has8(x):
	y = abs(x)
	y = str(y)
	a = False
	if '8' in y:
		a = True
	return a
w = int(input())
l = []
for i in range(w + 1, w + 19):
	if has8(i) == True:
		l.append(i)
print(min(l) - w)


a = int(input())
for i in range(1, 101):
	f = 0
	s = abs(a + i)
	while s > 0:
		if s % 10 == 8:
			f = 1
		s = s // 10
	if f == 1:
		ind = i
		break
print(ind)


import sys
import math

def main():
	n = int(sys.stdin.readline().strip())
	i = n + 1
	while True:
		if '8' in str(i):
			print(i - n)
			break
		i += 1
main()


n = int(input())
n = n + 1
c = 0
for i in range(5555555):
	if '8' in str(n):
		break
	else:
		c += 1
		n += 1
print(c + 1)


import sys
for line in sys.stdin.readlines():
	num = int(line.strip())
	for i in range(1, 8888888889 - num):
		if str(num + i).count('8'):
			print(i)
			break
	break


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

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

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	for r in range(1, 21):
		if '8' in str(n + r):
			return r
	return -1
print(main())


val = eval(input())
counter = 0
if str(8) in str(val):
	counter = counter + 1
	val = val + 1
while str(8) not in str(val):
	val = val + 1
	counter = counter + 1
print(counter)


curr_floor = int(input())
cnt = 0
while '8' not in str(curr_floor) or cnt == 0:
	curr_floor += 1
	cnt += 1
print(cnt)


n = int(input())
n1 = str(n)
count = 0
if n1.count('8') == 0:
	while n1.count('8') == 0:
		n += 1
		count += 1
		n1 = str(n)
	print(count)
	exit()
if n1.count('8') != 0 and str(n + 1).count('8') != 0:
	print(1)
	exit()
if n1.count('8') != 0 and str(n + 1).count('8') == 0:
	n += 1
	n1 = str(n)
	count = 1
	while str(n).count('8') == 0:
		count += 1
		n += 1
	print(count)
	exit()


def islucky(c):
	for d in str(c):
		if d == '8':
			return True
	return False
a = int(input(''))
b = a + 1
while not islucky(b):
	b += 1
print(b - a)


n = int(input())
i = 1
n += 1
t = 1
while t:
	m = str(n)
	c = m.find('8')
	if c == -1:
		i += 1
		n += 1
	else:
		t = 0
print(i)


n = int(input())
if n == -8:
	print(16)
else:
	for i in range(1, 21):
		s = str(n + i)
		if s.find('8') > -1:
			print(i)
			break


import sys
I = sys.stdin.readline
n = int(input())
if -9 < n < 0 and len(str(-n)):
	print(8 + -n)
else:
	for i in range(1, 11):
		if '8' in str(n + i):
			print(i)
			break


n = int(input())
cnt = 0

def ch(n):
	n = abs(n)
	while n > 0:
		t = int(n % 10)
		if t == 8:
			return True
		n /= 10
	return False
cnt += 1
n += 1
while ch(n) == False:
	n += 1
	cnt += 1
print(cnt)


import sys
n = input()
list = [str(x) for x in n]
y = 0
while True:
	y = y + 1
	n = int(n) + 1
	n = str(n)
	list = [str(x) for x in n]
	x = str(8) in list
	if x:
		print(y)
		exit()


n = int(input()) + 1
i = 1
while not '8' in str(n):
	n += 1
	i += 1
print(i)


def gigatower():
	floor = int(input())
	y = 1
	while True:
		for j in str(floor + y):
			if j == '8':
				print(y)
				return
		y += 1
gigatower()


n = input()
p = int(n)

def plus():
	c = 0
	for x in range(p + 1, p + 20):
		c += 1
		if '8' in str(x):
			break
	print(c)
plus()


n = int(input())
i = 0
i += 1
n += 1
while str(n).find('8') == -1:
	i += 1
	n += 1
print(i)


n = int(input())
c = 0
p = True
while p:
	c += 1
	n += 1
	if str(n).count('8') > 0:
		p = False
		break
print(c)


import sys, os
from collections import defaultdict
from math import gcd
input = sys.stdin.readline
read = lambda : list(map(int, input().strip().split()))

def f(n):
	n = abs(n)
	while n:
		if n % 10 == 8:
			return True
		n //= 10
	return False

def main():
	n = int(input())
	c = 1
	n += 1
	while True:
		if f(n):
			print(c)
			return
		n += 1
		c += 1
main()


inital = int(input())
for i in range(1, 17777777777):
	if str(inital + i).find('8') >= 0:
		print(i)
		break


n = int(input())
l = 0
if str(n).count('8') == 0:
	while str(n).count('8') == 0:
		n += 1
		l += 1
	print(l)
else:
	n += 1
	l += 1
	if str(n).count('8') == 0:
		while str(n).count('8') == 0:
			n += 1
			l += 1
		print(l)
	else:
		print(1)


n = int(input())
x = n
while True:
	x += 1
	if str(x).count('8') != 0:
		break
print(x - n)


alpha = int(input())
floor = alpha + 1
while not '8' in str(floor):
	floor += 1
print(floor - alpha)


a = int(input())
x = a + 1
flag = 0
while flag != 1:
	num = x
	if num >= 0:
		while num != 0:
			if num % 10 == 8:
				flag = 1
				break
			else:
				num = num // 10
	else:
		while num != 0:
			if abs(num) % 10 == 8:
				flag = 1
				break
			else:
				num = -1 * (abs(num) // 10)
	x += 1
print(x - a - 1)


a = int(input())
cp_a = a + 1
while '8' not in str(cp_a):
	cp_a += 1
print(cp_a - a)


m = int(input())
for i in range(100000):
	m = m + 1
	a = str(m)
	if a.find('8') is not -1:
		break
print(i + 1)


n = int(input())
a = n + 1
while str(a).find('8') == -1:
	a = a + 1
print(a - n)


def ghadr(n):
	if n < 0:
		n = -n
	return n

def test(n):
	f = 'NO'
	while n != 0:
		y = n % 10
		n = n // 10
		if y == 8:
			f = 'YES'
	return f
t = 0
n = int(input())
n = n + 1
while test(ghadr(n)) == 'NO':
	n = n + 1
	t = t + 1
print(t + 1)


import sys
a = input()
b = int(a)
for i in range(1, 17):
	b += 1
	a = str(b)
	for j in range(0, len(a)):
		if a[j] == '8':
			print(i)
			sys.exit()


def c(a):
	if str(a).find('8') == -1:
		return False
	else:
		return True
a = int(input())
k = 0
while True:
	a += 1
	k += 1
	if c(a):
		break
print(k)


n = int(input())
for i in range(1, 1000):
	floor = str(n + i)
	if '8' in floor:
		print(i)
		exit()


a = int(input())
ans = 0
for b in range(1, 20):
	if str(a + b).__contains__('8'):
		ans = b
		break
print(ans)


import sys
import math
a = int(sys.stdin.readline())
for i in range(1, 17):
	y = a + i
	for j in str(y):
		if j == '8':
			print(i)
			exit()


n = input()
for x in range(17):
	n = int(n)
	n += 1
	n = str(n)
	if '8' in n:
		print(x + 1)
		break


n = int(input())
step = 0
while True:
	step += 1
	n += 1
	if '8' in str(n):
		print(step)
		break


a = int(input())
b = 0
while True:
	b += 1
	for ch in str(a + b):
		if ch == '8':
			print(b)
			exit()


n = int(input())
i = n + 1
while True:
	d = str(i)
	if d.count('8') >= 1:
		print(i - n)
		break
	else:
		i += 1


n = int(input())

def luck(x):
	x = str(x)
	for i in x:
		if i == '8':
			return True
	return False
for i in range(1, 20):
	if luck(n + i):
		print(i)
		break


n = int(input())
c1 = 0
c2 = 0
a = int(n)
b = int(n)
c = 1
if n == -7:
	c1 = 15
elif n == -8:
	c1 = 16
elif n == -5:
	c1 = 13
elif n == -6:
	c1 = 14
elif n == -4:
	c1 = 12
else:
	for i in range(1, 12):
		check = a + i
		n_str = str(check)
		l = len(n_str)
		can = False
		for j in range(l):
			if n_str[j] == '8':
				c1 = i
				can = True
				break
		if can == True:
			break
print(c1)


s = input()
i = int(s)
c = 1
while True:
	up = i + c
	if '8' in str(up):
		break
	c += 1
print(c)


n = int(input())
k = 0
if n < 0:
	k = 1
	n = n * -1
line = list(map(int, list(str(n))))
if k == 0:
	if 8 in line[:-1] and line[-1] < 9:
		print(1)
	else:
		if line[-1] < 8:
			l = 8 - line[-1]
		elif line[-1] == 8:
			l = 10
		else:
			l = 9
		jp = 10 - line[-1]
		if jp >= l:
			print(l)
		else:
			n = n + jp
			line = list(map(int, list(str(n))))
			if 8 in line:
				print(jp)
			else:
				print(l)
elif n <= 8:
	print(n + 8)
elif 8 in line[:-1] and line[-1] != 0:
	print(1)
else:
	if line[-1] < 8:
		l = 2 + line[-1]
	elif line[-1] == 8:
		l = 10
	else:
		l = 1
	jp = line[-1] + 1
	if jp >= l:
		print(l)
	else:
		n = n - jp
		if n < 0:
			n = n * -1
		line = list(map(int, list(str(n))))
		if 8 in line:
			print(jp)
		else:
			print(l)


def int_To_List(num):
	List = list()
	cond = False
	for i in str(num):
		if i == '-':
			cond = True
		else:
			List.append(int(i))
	if cond:
		List[0] *= -1
	return List

def contador(num):
	cont = 0
	cond = False
	for i in range(1, 8888888888):
		num1 = num + i
		if 8 in int_To_List(num1) or -8 in int_To_List(num1):
			if cont == 0:
				cont += 1
				cond = True
				break
			else:
				break
		cont += 1
	if cond:
		return cont
	return cont + 1
Ent = int(input())
print(contador(Ent))


num = int(input())
j = 1
for i in range(1, 20):
	res = str(num + i)
	if res.find('8') != -1:
		j = i
		break
print(j)


a = int(input())
for i in range(a + 1, 100000000000):
	ss = str(i)
	ch = 0
	for j in range(len(ss)):
		if ss[j] == '8':
			ch = 1
			break
	if ch == 1:
		break
print(i - a)


from sys import stdin
n = int(stdin.read().split()[0])
b = 1
while '8' not in str(n + b):
	b += 1
print(b)


def checknum(n):
	n = abs(n)
	while n > 0:
		if n % 10 == 8:
			return True
		n = n // 10
	return False
a = int(input())
for i in range(1, 26):
	if checknum(a + i):
		print(i)
		break


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def main():
	pass

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def lts(l):
	s = ''.join(map(str, l))
	return s

def stl(s):
	l = list(s)
	return l

def sq(a, target, arr=[]):
	s = sum(arr)
	if s == target:
		return arr
	if s >= target:
		return
	for i in range(len(a)):
		n = a[i]
		remaining = a[i + 1:]
		ans = sq(remaining, target, arr + [n])
		if ans:
			return ans

def SieveOfEratosthenes(n):
	cnt = 0
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	for p in range(2, n + 1):
		if prime[p]:
			cnt += 1
	return cnt

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
mod = int(1000000000.0) + 7
import math
a = int(input())
a += 1
ans = 1
while True:
	if '8' in str(a):
		print(ans)
		break
	else:
		ans += 1
		a += 1


floor = input()
f = int(floor)
for i in range(1, 17, 1):
	f += 1
	if '8' in str(f):
		print(i)
		break