program z1;
 var a,b,c,i:int64;
     h:boolean;
begin
 readln(a);
 h:=true;
 b:=a+1;
 while(h)do
  begin
   c:=abs(b);
   while(c<>0)do
    begin
     if(c mod 10=8)
      then begin
            writeln(b-a);
            halt;
           end;
     c:=c div 10;
    end;
   inc(b);
  end;

end.

Var
  a: Int64;
  cnt: LongInt;

Function f(x: Int64): Boolean;
Begin
  f:=false;
  While x<>0 do begin
    If abs(x mod 10) = 8 then f:=true;
    x:=x div 10;
  End;
End;

Begin
  ReadLn(a);
  cnt:=1;
  inc(a);
  While not f(a) do begin
    inc(a);
    inc(cnt);
  End;
  WriteLn(cnt);
End.

uses math;
type maxx=array[0..200000] of longint;
var r,d,kol,n,c,i,k,z,j:longint;
    s:string; res,m1,m,dp,m2,left,right,vr,t:maxx;
    a,b:int64;
Begin
  // assign(input,'input.txt'); assign(output,'output.txt');
   readln(n);
   for i:=n+1 to n+100 do
     Begin
      a:=abs(i);
      while a>0 do
         Begin
            if a mod 10=8
            then Begin
                    writeln(i-n);
                    halt(0);
                 end;
            a:=a div 10;
         end;
     end;
end.

 const  eps=1e-11;  besk=200000000000000008;
    modul=1000000007;
   label 1,2,3,4;
    type

    mas=array [-10000..10000000] of int64;   point=record x,y,z:real;end;
    zap=record p1,p2,p3 :int64;end; zap1=^zap;
    mass=array[-10000..10000000] of int64;mass1=^mass;
    var p3,p4,t4,t5,t6,t,t1,t2,t3,cc,aa,bb,jj,pold,xx,yy,pp,n2,ost,ll,rr,p,q,tt,n1,h,n,kk,qq,ot,kol,nn,p1,p2,x0,y0,s1,s2,m,s,imax,smin,dl,besk1:int64;
    shag,imin,ii,k,i1,i2,i3,i4,i5,i6,i7,j1,j2,mask,step,i,j:longint;
     sssnew:array[-10..1000] of char;
    poin:zap;
    vec:array[-100..1000] of zap;
     c1,c2:array[-1000..100000] of int64;
    fact,d, a1,bl,br,c,a,b:array[-300000..2000000] of int64;
     maxsum:array[-1..1010,-1..1010] of int64;
    sss, ss1,ss2:string;
    newgr,gr:array[-100..200000] of boolean;
    pole:array[-1..1500,-1..1500] of int64;
    ss:array[-100..1000000] of string;
    ch: char;
    zan,marked:array[-10..1000000] of boolean;
    maxpr:array[0..100000] of string;
     pr,aanew,v0,v1,s0,t0:extended;
     z,x1,y1,y,x:array[-1..300000] of int64;
     xxx,yyy:array[-1..100000] of double;
    xxnew,per,pp2, ee,yot:double;
       flagg,flag2,flag,flag1:boolean;
    function al(x,y:real):real; var t0,t1,p,s0,s1:real;
 begin
     if (x>0)and(y>=0) then p:=arctan(y/x);
     if x<0 then p:=pi+arctan(y/x);
     if(x>0)and(y<0) then p:=2*pi+arctan(y/x);
     if x=0 then if (y>=0) then p:=pi/2 else p:=3*pi/2;
     al:=p;
 end;
  function min(x,y:int64):int64;begin min:=x;if y<x then min:=y; end;
  function max(x,y:int64):int64;begin max:=x;if y>x then max:=y; end;

  function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

  function evkl(a,b:int64):zap1; var d,x,y,r,q,i,j,k,x1,x2,y1,y2:int64;
  tt:zap; tt1:zap1;
begin
  if a<b then begin r:=a;a:=b;b:=r; end;
  x2:=1;x1:=0;y2:=0;y1:=1;
  while b>0 do
    begin q:=a div b; r:=a mod b; x:=x2-q*x1;y:=y2-q*y1;
          a:=b;b:=r;x2:=x1;x1:=x;y2:=y1;y1:=y;
    end;
    d:=a; x:=x2;y:=y2; tt.p1:=d;tt.p2:=x;tt.p3:=y; tt1:=@tt;
   evkl:=tt1;
end;

function degg(a:int64;k:int64):int64; var p:int64;
begin
 if k<=0 then degg:=1 else if odd(k) then degg:=(degg(a,k-1)*a) mod modul  else
   begin  p:=degg(a,k div 2); degg:=(p*p) mod modul;    end;

end;

function est8(p:int64):boolean;  var fl:boolean;
 begin
   if p<0 then p:=-p; fl:=false;
   while p>0 do begin  if p mod 10=8 then fl:=true; p:=p div 10;  end;
   est8:=fl;
 end;

begin

   {assign (input,'E:\Projects\input.txt');reset(input);
      assign (output,'E:\Projects\output.txt'); rewrite(output);
    }
  readln(n);
   repeat inc(n); inc(ot); until  est8(n);
   writeln(ot);

     1:          close(output);
end.

var n:string;
    k,rs,x,err,i:integer;
begin
readln(n);
k:=0;
rs:=0;
while (k=0) or (rs=1) do begin
val(n,x,err);
k:=0;
for i:=1 to length(n) do
  if n[i]='8' then inc(k);
inc(x);
str(x,n);
inc(rs);
end;
writeln(rs-1);
end.

{$APPTYPE CONSOLE}
{$R+,Q+,I+,O-}
uses SysUtils;
var n,m,i,j,l,k:longint;
    s:string;
    f:boolean;
begin
  readln(n);
  f:=false;
  for i:=n+1 to n+1000 do
  begin
    str(i,s);
    for j:=1 to length(s) do if (s[j]='8') then
    begin
      m:=i-n;
      f:=true;
      break;
    end;
    if (f) then break;
  end;
  writeln(m);
  read(n);
end.

program zad_1;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
   i, j, u, q :integer;
   n :int64;

function prov(nn :int64):boolean;
var
   i:integer;
   n :int64;
begin
    i := 0;
    n := abs(nn);
    while (n <> 0) do
    begin
        if (n mod 10 = 8) then
           inc(i);
           n := n div 10;
    end;
    if (i <> 0) then
         prov := true
    else
        prov := false;
end;

begin
    readln(n);
    q := 1;
    inc(n);
    while (prov(n) = false) do
    begin
        inc(n);
        inc(q);
    end;
    writeln(q);
    readln;
    readln;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='x';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,rr:array[0..1000000]of longint;
    qc:array[0..2000,0..2000]of int64;
    ss:array[0..1000]of string;
    s,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    res,cur:int64;
    aa,bb,u,v,nt,ii,jj,kk,nn,mm,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,max,min:longint;
    test,ll,t,tt:longint;
    b,bbb,b0,b1,b2,b3:boolean;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function gcd(q,c:int64):int64;
  begin
  while ((q>0)and(c>0)) do
    if q>c then q:=q mod c else c:=c mod q;
  if q>0 then gcd:=q else gcd:=c;
  end;

procedure run;
var i,j,k,z,s:longint;
    r,m,x:int64;
  begin
  //init;
  read(n);
  inc(n);
  res:=1;
  while true do
    begin
    cur:=n;
    if cur<0 then cur:=-cur;
    for i:=0 to 10 do
      begin
      if cur mod 10=8 then begin writeln(res); exit; end;
      cur:=cur div 10;
      end;
    inc(res);
    inc(n);
    end;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

var a,i,k:longint;
    f:boolean;
begin
  read(a);
  for i:=a+1 to a+30 do
  begin
    k:=i;
    f:=false;
    while k<>0 do
    begin
      if abs(k)mod 10=8 then f:=true;
      k:=k div 10
    end;
    if f then break
  end;
  write(i-a)
end.

Var a,aa:int64;
Function prov(a:int64):boolean;
Begin
  while a<>0 do
    begin
      if abs(a mod 10)=8 then
        begin
          prov:=true;
          exit;
        end;
      a:=a div 10;
    end;
  prov:=false;
end;
begin
 // assign(input,'input.txt');assign(output,'output.txt');
  readln(aa);
  a:=aa;
  inc(a);
  while not prov(A) do inc(a);
  writeln(a-aa);
end.

Var i,n,a,x,k,l:LongInt;
 begin
  read(a);
  l:=1;
  for i:=a+1 to a+100 do
   Begin
    x:=abs(i);
    While x>0 do
     Begin
      if x mod 10=8 then k:=1;
      x:=x div 10;
     End;
    if k=1 then
     Begin
      Write(l);
      halt;
     End;
    inc(l);
   End;
 End.

var a,n,c,i:longint;
begin
read(a);
for i:=1 to 16 do begin
if a>-8 then begin
a:=a+1;
c:=a;
while c>0 do begin
n:=c mod 10;
c:=c div 10;
if n=8 then begin
write(i);
break;
end;
end;
end;
if a<=-8 then begin
a:=a+1;
c:=a*(-1);
while c>0 do begin
n:=c mod 10;
c:=c div 10;
if n=8 then begin
write(i);
break;
end;
end;
end;
if n=8 then break;
end;
end.

var n,m,i,j,k,s,g,f,d:longint;
begin
{assign(input,'input.txt'); reset(input);
assign(output,'output.txt'); rewrite(output);  }
read(n);
n:=n+1;
k:=0;
s:=1;
while k<>1 do begin
f:=abs(n);
while f>0 do begin
d:=f mod 10;
if d=8 then begin k:=1; break; end;
f:=f div 10;
end;
inc(s);
n:=n+1;
end;
write(s-1);
{close(input);
close(output); }
end.

Var
  n,i:integer;
function check(n:integer): boolean;
begin
  check:=false;
  while n<>0 do begin if abs(n mod 10)=8 then check:=true; n:=n div 10; end;
end;
begin
  readln(n); i:=1;
  while not check(n+i) do inc(i);
  writeln(i);
  readln;
end.

var S:STRING;
    n:int64;
    i,j:integer;
    kq:boolean;
BEGIN
    readln(n);
    for i:=1 to 100 do
    begin
        n:=n+1;
        str(n,s);
        kq:=false;
        for j:=1 to length(s) do
            if s[j]='8' then
            begin
                writeln(i);
                kq:=true;
                break;
            end;
        if kq=true then break;
    end;
    readln;
end.

var a,k,i: longint; s,q:string;
begin
readln(a);
k:=1;
a:=a+1;
q:='8';
str(a,s);
i:=pos(q,s);
if i<>0 then begin writeln(1); halt; end;
while i=0  do
begin
k:=k+1;
a:=a+1;
str(a,s);
i:=pos(q,s);
end;
writeln(k);
end.

Program PBA;
Var a:longint;
i:byte;
st:string;
Begin
readln(a);
For i:=1 to 16 do
Begin
inc(a);
str(a,st);
If pos('8',st)<>0 then
Begin
write(i);
exit;
End;
End;
End.

program spcm;
var i,n,j,k,kk:int64;
begin
{assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output); }
read(n);
i:=n ;
kk:=0;
while true do
  begin
   inc(i);
   inc(kk);
   j:=abs(i);
   while j<>0 do
    begin
     if j mod 10<>8 then
      j:=j div 10
     else begin k:=1; writeln(kk); HALT; end;
    end;
  //  if i>888888888 then break;
  end;
{close(output);
close(input);}
end.

program bashnya;
var a,b:int64;

function proverka(a:int64):boolean;
begin
if a<0 then a:=-a;
proverka:=false;
while a<>0 do
    begin
    if a mod 10=8 then
        begin
        proverka:=true;
        break;
        end;
    a:=a div 10;
    end;

end;

begin
read(a);
b:=1;
while true do
    begin
    if proverka(a+b)=true then break;
    inc(b);
    end;
write(b);
end.

//488a
var n,i,j,k:int64;
    b:boolean;
begin
 read(i);
 b:=true;
 while b=true do
  begin
    inc(i);
    inc(j);

    k:=abs(i);
    while (k<>0) and ( k mod 10<>8) do k:=k div 10;
    if (k mod 10)=8 then b:=false;

  end;
  write(j);
 end.

  var a,c,x,y:array [1..100000] of longint;
  n,k:int64;
      function p(xx:int64):boolean;
       begin
       xx:=abs(Xx);
        while (xx>0) do
         begin
          if xx mod 10 = 8 then exit(true);
          xx:=xx div 10;
          end;
          exit(false);
       end;
  begin
   read(n);
   inc(n);
   inc(k);
     while true do
      begin
       if p(n) then break;
       inc(n);
       inc(k);
      end;
      writeln(k);
  end.

program chuoi;
var
     a,b,res:int64;
     s:string;
     i:integer;
function ok(s:string):boolean;
begin
    for i:=1 to length(s)do if(s[i]='8')then exit(true);
    exit(false);
end;
begin
     readln(a);
     res:=1;
     a:=a+1;
     b:=abs(a);
     str(b,s);
     while(not ok(s))do
      begin
          res:=res+1;
          a:=a+1;
          b:=abs(a);
          str(b,s);
      end;
     writeln(res);
end.

const fi='';
      fo='';
var a,b:int64;
    f:text;
procedure input;
begin
 assign(f,fi);
 reset(f);
 read(f,a);
 close(f);
end;
function chk(n:int64):boolean;
var s:string;
begin
 str(n,s);
 if pos('8',s)<>0 then exit(true)
 else exit(false);
end;
procedure solve;
begin
 b:=a+1;
 while not chk(b) do
  b:=b+1;
end;
procedure output;
begin
 assign(f,fo);
 rewrite(f);
 write(f,b-a);
 close(f);
end;
begin
 input;
 solve;
 output;
end.

program zzz;
var
  x, i: int64;
  stop: boolean;
function Has8(x: int64): boolean;
var
  s: ansistring;
  i: byte;
begin
  Str(x, s);
  for i := Length(s) downto 1 do
    if s[i] = '8'
    then begin
           Has8 := true;
           exit;
         end;
  Has8 := false;
end;
begin
  read(x);
  i := x + 1;
  stop := false;
  while not stop do
  begin
    if Has8(i)
    then stop := true
    else inc(i);
  end;
  write(i - x);
end.

var a,k,c:int64; i:longint; t:boolean;
begin
read(a);
t:=false;
while(t=false)do
begin
a:=a+1; i:=i+1;
k:=a;
  while(k<>0)do
  begin
  c:=abs(k mod 10);
  if(c=8)then begin writeln(i); exit; end;
  k:=k div 10;
  end;
end;
end.

{-------------------------------------------------
----oo--o--o-o---o--o----o------oo--o-----o-oooo----
---o--o-oo-o-o----ooo----o-----o--o--o---o--oooo----
---o--o-o-oo-o------o----o-----o--o---o-o---o-------
----oo--o--o-oooo-oo-----ooooo--oo-----o----oooo----
------------------------------------------------}
{$MODE OBJFPC}
program Onlylove;
const maxN =10;
var a : int64;

procedure enter;
   begin
        readln(a);

   end;
function check(a : int64)  : boolean;
   var r : integer;
       q : int64;
   begin
       q :=a ;
      if q < 0 then q := -q;
      while q <> 0 do
        begin
             r := q mod 10 ;
             if r = 8 then exit(true) ;
             q := q div 10 ;
        end;
        exit(false);
   end;
procedure solve;
    var i : integer;
   begin
     for i:=1 to 25 do
       begin
         inc(a);
         if check(a)  then
            begin Writeln(i); break; end;
       end;
   end;

begin
  enter;
  solve;

end.

var
 a, j, i, x: Integer;
begin
  ReadLn(a);
  for i:=1 to 30 do
  begin
    a:=a + 1;
    x:=a;
    while  x <> 0 do
    begin
      if abs(x mod 10) = 8 then
      begin
        WriteLn(i);
        Halt;
      end;
      x:=x div 10;
    end;
  end
end.

var
    a,kq:longint;
function check(n:longint):boolean;
var
    i,j:longint;
begin
        while n<>0 do
        begin
            j:=n mod 10;
            n:=n div 10;
            if (j=8) or (j=-8) then
                exit(true);
        end;
    exit(false);
end;
function cal(n:longint):longint;
var
    i,dem:longint;
begin
    dem:=0;
    if check(n) then
    begin
        n:=n+1;
        if check(n) then
            exit(1)
        else
            dem:=dem+1;
    end;
    while check(n)=false do
    begin
        n:=n+1;
        dem:=dem+1;
    end;
    exit(dem);
end;
begin
    //assign(input,'lucky.inp');reset(input);
    ///assign(output,'lucky.out');rewrite(output);
    readln(a);
    kq:=cal(a);
    write(kq);
    //close(input);
    //close(output);
end.

var
     s:String;
     N,i,L,ans,j:Longint;
begin
     Readln(N);
     for i:=N+1 to N+25 do
begin
     Str(i,S);
     L:=Length(S);
     ans:=0;
     for j:=1 to L do
     if s[j]='8' then begin
                           ans:=i;
                           Break;
                       end;
     if ans<>0 then Break;
 end;
     Writeln(ans-N);
 end.

program gt;
label 1;
var q,a,b,p,r:longint;
begin
readln(a);
r:=a;
p:=0;
1:
a:=a+1;
b:=abs(a);
while b>0 do
begin
q:=b mod 10;
b:=b div 10;
if(q=8)then begin
p:=1;
break;
end;
end;
if(p=1)then writeln(a-r) else goto 1;
end.

var
	found		: boolean;
	a,k,b,c		: longint;
begin

	readln(a);
	found:=false;
	k:=0;

	while not(found) do
	begin
		k:=k+1;
		a:=a+1;
		c:=abs(a);
		while c>0 do
		begin
			b:= c mod 10;
			c:=c div 10;
			if b=8 then
				found:=true;
		end;
	end;
	writeln(k);
end.

Var n,n2:Int64;
{=}
Function Check:Boolean;
Var i:Integer; x:String;
Begin
 Str(n,x);
 For i:=1 to Length(x) do If x[i]='8' then Exit(True);
 Exit(False);
End;
{=}
Begin
 Readln(n);
 n2:=n;
 Repeat
  Inc(n);
 Until Check;
 Writeln(n-n2);
 Readln
End.

{$mode objfpc}
uses math;
const
                finp            =               '';
                fout            =               '';
var
                fi,fo           :               text;
procedure openfile;
begin
        assign(fi,finp);reset(fi);
        assign(fo,fout);rewrite(fo);
end;
procedure closefile;
begin
        close(fi);close(fo);
end;
function ok(x:int64):boolean;
var
        i               :               integer;
begin
        x:=abs(x);
        while x<>0 do
        begin
                if x mod 10=8 then
                        exit(true);
                x:=x div 10;
        end;
        exit(false);
end;
procedure process;
var
        n,res           :               int64;
begin
        readln(fi,n);
        res:=0;
        repeat
                inc(n);inc(res);
                if ok(n) then
                        break;
        until false;
        writeln(fo,res);
end;
begin
        openfile;
        process;
        closefile;
end.

var
  a,m,ans,k:longint;

begin
  read(a);

  while true do
  begin
    inc(a);
    inc(k);
    m:=a;
    while m<>0 do
    begin
      if (m mod 10 = 8)or (m mod 10 = -8) then begin write(k); halt; end;
      m:=m div 10;
    end;
  end;
end.

program cf488A;
var a,b,i:longint;

begin
read(a);
for i:=1 to 100 do
        begin
        b:=a+i;
        while abs(b)>0 do
                begin
                if (abs(b) mod 10=8) then
                        begin
                        writeln(i);
                        exit;
                        end;
                b:=b div 10;
                end;
        end;
end.

var
N,M,K:int64;
i,a,s,f:longint;

BEGIN
readln(N);
M:=N;K:=N;
f:=0;
s:=-1;
while(f=0) do begin
 s:=s+1;
 N:=abs(M);
 for i:=1 to 11 do begin
  a:=N mod 10;N:=N div 10;
  if(a=8) then begin f:=1;end;
 end;
 M:=M+1;
end;

if(s=0) then begin
 M:=K+1;
f:=0;
s:=0;
while(f=0) do begin
 s:=s+1;
 N:=abs(M);
 for i:=1 to 11 do begin
  a:=N mod 10;N:=N div 10;
  if(a=8) then begin f:=1;end;
 end;
 M:=M+1;
end;

end;
writeln(s);

END.

var
  a,ans : int64;

  function chk(x : int64) : boolean;
    begin
      x:=abs(x);
      while x <> 0 do begin
        if x mod 10 = 8 then exit(true);
        x:=x div 10;
      end;
      exit(false);
    end;

begin
  readln(a);
  inc(a);
  while not chk(a) do begin inc(a); inc(ans); end;
  writeln(ans+1);
end.

var
    i:longint;
    n:int64;
    s:ansistring;

Begin
    read(n);
    for i:=1 to 100 do
        begin
            str(n + i, s);
            if pos('8',s) > 0 then
                begin
                    writeln(i);
                    halt;
                end;
        end;
end.

var n,i: longint;

function check(a: longint): boolean;
var x: longint;
begin
    While a<>0 do
    begin
        x:=a mod 10;
        If abs(x)=8 then exit(true);
        a:= a div 10;
    end;
    exit(false);
end;

BEGIN
    readln(n);
    If (n>=-8) and (n<8) then writeln(8-n)
    Else
    begin
        For i:=1 to 10 do
            If check(n+i) then
            begin
                writeln(i);
                break
            end;
    end;
END.

var n,res : int64;
function check(a:int64):boolean;
begin
    if a <0 then a:=-a;
    while a <> 0 do
      begin
          if (a mod 10=8) then exit(true);
          a:=a div 10;
      end;
    exit(false);
end;
begin
    readln(n); //n:=n+1000000000;
    res:=1;
    while not check(n+res) do inc(res);
    writeln(res);
end.

var n ,i ,k ,j,p :longint;
  f: boolean;
  begin
  read(n); f:=true;
    while  f do begin
       Inc(n);
       Inc(k);   p:=Abs(n);
        while p>0 do begin
            i:=p mod 10;
              if i=8 then begin writeln(k); exit; end;
              p:=p div 10;
            end;
        end;
  end.

uses sysutils;

var
 a:string;
 b,x:integer;
 t8,i:integer;
 stop:boolean;

procedure check;
 begin
 for i:=1 to length(a) do
   if a[i]='8' then stop:=true;
 end;

begin
readln(a);
for i:=1 to length(a) do
  if a[i]='8' then inc(t8);
x:=StrToInt(a);
if t8>1 then b:=1
 else
 begin
 stop:=false;
 x:=StrToInt(a);
 check;
 while ((stop=false) OR (b=0)) do
   begin
   inc(x);
   a:=IntToStr(x);
   inc(b);
   stop:=false;
   check;
   end;
 end;
writeln(b);
readln;
end.

uses sysutils;
var a, b, i: longint;
    s: string;
begin
        readln(a);
        for b := 1 to 20 do
        begin
                inc(a);
                s := inttostr(a);
                for i := 1 to length(s) do
                        if s[i] = '8' then
                        begin
                                writeln(b);
                                exit;
                        end;
        end;
end.

var
a:int64;
j,i:longint;
s:String;
begin
readln(a);
for i:=1 to  1000000 do begin
    a:=a+1;
    str(a,s);
    for j:=1 to length(s) do if s[j]='8' then begin
        writeln(i);
        halt;
    end;
end;
end.

var s:string;
    n,k,l:Int64;
    i,j:longint;
  begin
    read(n);
    for i:=1 to 30 do
      begin
        inc(n);
        str(n,s);
        for j:=1 to length(s) do
          if s[j]='8' then begin write(i); exit; end;
      end;
  end.

var a,b,c,d,f:longint;
begin
readln(a);
repeat
b:=b+1;
c:=abs(a+b) div 10;
d:=abs(a+b) mod 10;
if d=8 then
begin
f:=1;
writeln(b);
break
end else
while c>0 do
begin
d:=c mod 10;
c:=c div 10;
if (d=8) and (f=0) then
begin
writeln(b);
f:=1;
end;
end;
until f=1;
end.

var i,b,k,a:longint;
begin
read(a);
b:=0;
k:=abs(a);
for i:=1 to 16 do begin
if a<0 then b:=k-i
else b:=k+i;
while b div 10>0 do begin
if b mod 10=8 then break;
b:=b div 10;
end;
if abs(b mod 10)=8 then break;
end;
write(i);
end.

Var
  a,b:integer;
  s:string;
Begin
  Read (a);
  b:=0;
  repeat
  inc(b);
  inc(a);
  str(a,s);
  until pos('8',s)>0;
  Write (b);
ENd.

var
 f:boolean;
 t,dx1,dx,x:longint;
begin
 readln(x);
 dx:=x;
 while(true)do
 begin
  inc(dx);
  t:=dx;
  f:=false;
  while(t<>0)do
  begin
   if abs(t mod 10)= 8 then f:=true;
   t:=t div 10;
  end;
  if f then break;
 end;
 writeln(dx-x);
end.

var  i,kil:longint;
n:int64;
t:string;
flag:boolean;
begin
readln(n);
if n=0 then kil:=8;
if n<>0 then
        begin
         repeat
          inc(n);
          inc(kil);
          str(n,t);
          for i:=1 to length(t) do if t[i]='8' then begin flag:=true; break; end;
         until flag=true;
        end;

writeln(kil);
end.

var n,i,a,x:longint;
begin
read(a);
for i := 1 to 20 do
 begin
  n:=a+i;
  If n<0 then n:=-n;
  While n>0 do
   begin
    x:=n mod 10;
    n:=n div 10;
    If x = 8 then begin write(i); halt; end;
   end;
 end;
end.

var p,a,k:int64;
st:string;
begin
  readln(a);
  while true do
  begin
    a:=a+1;
    k:=k+1;
    str(a,st);
    p:=pos('8',st);
    if (p<>0) then begin
                 writeln(k);
                 break;
                 end;
    p:=0;
  end;
end.

const   fi='';
        fo='';
var     f,g:Text;
        n,t:int64;
        function check(o:int64):boolean;
        var     t:byte;
                begin
                        while o<>0 do
                        begin
                                t:=o mod 10;
                                if t=8 then exit(true);
                                o:=o div 10;
                        end;
                        exit(False);
                end;
begin
        assign(f,fi);
        reset(F);
        assign(G,fo);
        rewrite(G);
        readln(F,n);
        close(f);

        t:=1;
        while check(abs(n+t))=false do inc(t);
        writeln(G,t);
        close(G);
end.

{$MODE OBJFPC}
const max1=100000;
type vector=array[1..max1] of integer;
var
  x:vector;
  s:ansistring;
  fi,fo:textfile;
  n,k:integer;
procedure enter;
 var i,j:integer;
   begin
     readln(n);
   end;
function solve(n:integer):integer;
  var i,j:integer;
    begin
      for i:=1 to 888888888 do
         begin
           n:=n+i;
           str(n,s);
           for j:=1 to length(s) do
              begin
                if s[j]='8' then exit(i);
              end;
           n:=n-i;
         end;
    end;
procedure print;
  var i:integer;
    begin
     writeln(solve(n));
    end;
begin
  {assignfile(fi,'gigatower.inp');reset(fi);
  assignfile(fo,'gigatower.out');rewrite(Fo); }
  enter;
  print;
  {closefile(fi);
  closefile(fo);}
end.

uses math;
var
  a,av:longint;
  i,iv,h:longint;
begin
  read(a);
  if a<0 then
    begin
      av:=abs(a);
      for i:=av-1 downto 0 do
        begin
          iv:=i;
          h:=0;
          repeat
            if iv mod 10=8 then begin h:=1; break; end;
            iv:=iv div 10;
          until iv=0;
          if h=1 then begin writeln(abs(i-av)); halt; end;
        end;
    end;
  if a<0 then begin
    i:=1;
    repeat
      iv:=i;
      h:=0;
      repeat
        if iv mod 10=8 then begin h:=1; break; end;
        iv:=iv div 10;
      until iv=0;
      if (h=1) and (i>a) then begin writeln(i-a); halt; end;
      inc(i);
    until i=8888888888;
              end
  else
    begin
    i:=a+1;
    repeat
      iv:=i;
      h:=0;
      repeat
        if iv mod 10=8 then begin h:=1; break; end;
        iv:=iv div 10;
      until iv=0;
      if (h=1) and (i>a) then begin writeln(i-a); halt; end;
      inc(i);
    until i=8888888888;
    end;
end.

var
 i,n,b,k,j: longint;
 s: string;
begin
 readln(n);
 while j <> 1 do
 begin
  str(n,s);
  k:=pos('8',s);
  if (b <> 0) and (k <> 0) then begin writeln(b); halt; end;
  inc(b);
  inc(n);
  k:=0;
 end;
end.

Var n,n1,f,n2,q:LongInt;
 Begin
  Readln(n);

  n1:=n;
  f:=1;
  While f=1 do
   begin

    if n2=0 then n1:=n1+1;
    if n2=0 then n2:=n1;
    q:=n2 mod 10;
    if abs(q) = 8 then break;
    n2:=n2 div 10;
   end;
  write(abs(n-n1));
 End.

var a,i,x,k,n:longint;
Begin
 read(a);
 for i:=1 to 888888888 do begin
 if a>=0 then  begin a:=a+1; k:=a; end
  else begin k:=abs(a)-1; a:=a+1; end;
   x:=k;
   while x>0 do begin
      n:=x mod 10;
      x:=x div 10;
      if n=8 then break;
   end;
  if n=8  then break;
 end;

write(i);
 End.

program codeforces_round278_a;

var
  i, a, b, f, x : longint;

begin
  read(a);
  for i:=1 to 10000 do
    begin
      x:=a + i;
      f:=0;
      while x <> 0 do
        begin
          if abs(x mod 10) = 8
             then begin
                    f:=1;
                    break;
                  end;
          x:=x div 10;
        end;
      if f = 1
         then begin
                b:=i;
                break;
              end;
    end;
  write(b);
end.

uses math;
var n, i: int64;
    s: string;
begin
 readln(n);
 i:=n+1;
 while true do
  begin
   str(i, s);
   if pos('8', s) > 0 then break;
   inc(i);
  end;
 writeln(i-n);
end.

var a, i, aa, q:longint;
    bool:boolean;
begin
//assign(input, 'input.txt'); reset(input);
//assign(output, 'output.txt'); rewrite(output);

readln(a);
if a>0 then
begin
bool:=false;
for i:=1 to 20 do
 begin

 aa:=a+i;
 while (aa<>0) do
  begin
  q:=aa mod 10;
  aa:=aa div 10;
  if q=8 then bool:=true;
  end;

 if bool then break;
 end;
end
else
begin
if a=0 then i:=8
       else if (a<-9)
            then begin
                 a:=a*(-1);
                 bool:=false;
                 for i:=1 to 20 do
                  begin
                  aa:=a-i;

                  while (aa<>0) do
                   begin
                   q:=aa mod 10;
                   aa:=aa div 10;
                   if q=8 then bool:=true;
                   end;
                  if bool then break;
                  end;

                 end
            else begin
                 i:=a*(-1)+8;
                 end;
end;

write(i);

//close(input); close(output);
end.

var i,j,a,b:integer;
begin
Readln(a);
i:=0;
inc(a);
b:=0;
while(i<>8) do
 begin
 j:=abs(a);
 inc(b);
  while(j<>0) do
  begin
  if(j mod 10=8) then i:=8;
  j:=j div 10;
  end;
  inc(a);
 end;
 writeln(b);
end.

VAR  a,a1:int64;
i,f:dword;
BEGIN
readln(a);
{a1:=a;
while a1>0 do begin
if a1 mod 10 =8 then begin writeln('0');
exit;
end;
a1:=a1 div 10;
end; }

for i:=1 to 100000000 do begin
  a1:=a+i;
  a1:=abs(a1);
  while a1>0 do begin
    if a1 mod 10 =8 then begin
    f:=1;
    break;
    end;
    a1:=a1 div 10;
  end;
  if f=1 then begin
  writeln(i);
  exit;
  end;
end;
END.

var ot,a,i,x,p,k,kl:longint;
begin
  readln(a);
  if a=999999998 then writeln(10)
    else if a=999999999 then writeln(9)
       else if a=1000000000 then writeln(8)
  else
  BEGIN
  for i:=a+1 to 999999998 do
    begin
      x:=abs(i);
      while x>0 do
        begin
          p:=x mod 10;
          if p=8 then begin
                        k:=i;
                        kl:=1;
                        break;
                      end;
          x:=x div 10;
        end;
      if kl=1 then break;
    end;

  ot:=k-a;
  writeln(ot);
  END;
end.

var s:string;
	k,i,dem:longint;
begin
	readln(s);
		dem:=0;
		val(s,k,i);
		inc(k);
		inc(dem);
		str(k,s);
		while pos('8',s)=0 do
		begin
			val(s,k,i);
			inc(k);
			str(k,s);
			inc(dem);
		end;
		writeln(dem);
end.

var a,b,n,c,i: longint;
begin
read(a);
for i:=1 to 20 do begin
if a>-8 then begin
a:=a+1;
c:=a;
while c>0 do begin
n:=c mod 10;
c:=c div 10;
if n=8 then begin
write(i);
break;
end;
end;
if n=8 then break;
end;
if a<=-8 then begin
a:=a+1;
c:=a*-1;
while c>0 do begin
n:=c mod 10;
c:=c div 10;
if n=8 then begin
write(i);
break;
end;
end;
if n=8 then break;
end;
end;
end.

var x:longint;
function check(k:longint):boolean;
var a:longint;
begin
    a:=abs(k);
    while (a>0) do
    begin
        if (a mod 10=8) then exit (true);
        a:=a div 10;
    end;
    exit(false);
end;
function find:longint;
var i:longint;
begin
    for i:=1 to 16 do
    if (check(x+i)=true) then exit(i);
end;
begin
    readln(x);
    writeln(find);
end.

var s,n:int64; p:string;
begin
readln(n);
while true do
  begin
  n:=n+1; s:=s+1;
  str(n,p);
  if pos('8',p)<>0 then break;
  end;
writeln(s);
end.

VAR
  A,S,D,F,G:INTEGER;
begin
  READLN(A);
  while (g<>1) do
  begin
    f:=f+1;
    s:=a+f;
    while(s<>0) do
    begin
      d:=s mod 10;
      if(d=8) or (d=-8) then g:=1;
      s:=s div 10;
    end;
  end;
  writeln(f);
end.

{$MODE OBJFPC}
const inp = '';
      outp = '';
var fi, fo: text;
    a : int64;
    ans : longint;

function check(x : int64): boolean;
var tmp : longint;
begin
  while (x > 0) do
    begin
      tmp := x mod 10;
      if tmp = 8 then exit(true);
      x := x div 10;
    end;
  exit(false);
end;

procedure INPUT;
begin
  assign(fi,inp); assign(fo,outp);
  reset(fi); rewrite(fo);
  readln(fi,a);
  ans := 1;
  a := a + 1;
  while not check(abs(a)) do
    begin
      inc(a);
      inc(ans);
    end;
  writeln(fo,ans);
end;

procedure OUTPUT;
begin
  close(fi); close(fo);
end;

begin
  INPUT;
  OUTPUT;
end.

uses
   math;
var
   n,k:int64;
procedure busca(x:int64);
begin
    while x>0 do
    begin
       if x mod 10 =8 then
       begin
          writeln(k);
          halt;
       end;
       x:=x div 10;
    end;
end;

begin
   readln(n);
   while true do
   begin
      k:=k+1;
      busca (abs(n+k));
   end;
end.

Uses sysutils;

var n:int64;
s:string;
i,k:integer;
begin
readln(n);
for i:=1 to 20 do begin
n+=1;
s:=inttostr(n);
for k:=1 to length(s) do
if s[k]='8' then begin
writeln(i);
exit;
end;
end;
end.

var b,a,i,c,n:longint;
begin
read(a);
for i:=1 to 16 do begin
 if a>-8 then begin
  a:=a+1;
  c:=a;
  while c>0 do begin
   n:=c mod 10;
   c:=c div 10;
   if n=8 then begin write(i); break;
   end;
  end;
  if n=8 then break;
  end;
 if a<=-8 then begin
  a:=a+1;
  c:=a*(-1);
  while c>0 do begin
  n:=c mod 10;
   c:=c div 10;
   if n=8 then begin write(i); break;
   end;
  end;
  if n=8 then break;
  end;
 end;
end.

type int64=longint;
var i,n,x:int64;

function sch:boolean;
   var xx:int64;
   begin
   sch:=false;
   inc(n);
   xx:=n;
   while xx<>0 do
      begin
      if abs(xx mod 10) = 8
         then sch:=true;
      xx:=xx div 10;
      end;
   end;
begin
read(n);
i:=1;
while not(sch) do inc(i);
write(i);
end.

var
 a,b:longint;
function change(x:longint):boolean;
begin
 x:=abs(x);
 while x>0 do
  begin
   if x mod 10=8 then exit(true);
   x:=x div 10;
  end;
 exit(false);
end;
begin
 read(a);
 b:=1;
 while not (change(a+b)) do inc(b);
 writeln(b);
end.

var
	a,n		: integer;
	s		: string;

begin
	readln(s);
	n:=length(s);
	case s[n] of
		'0' : a:=0;
		'1' : a:=1;
		'2' : a:=2;
		'3' : a:=3;
		'4' : a:=4;
		'5' : a:=5;
		'6' : a:=6;
		'7' : a:=7;
		'8' : a:=8;
		'9' : a:=9;
	end;
	if s[1]<>'-' then
	begin

		if n=1 then
		begin

			if a<8 then
			begin
				writeln(8-a);
			end else
				writeln(18-a);

		end else

		begin
			//writeln('yes');
			if a<8 then
			begin
				writeln(8-a);
			end else

			begin
				if s[n-1]='7' then
				begin
					writeln(10-a);
				end else
					writeln(18-a);
			end;
		end;
	end else
	begin
		if n=2 then
		begin
			if a<=8 then
			begin
				writeln(8+a);
			end else
				writeln(1);
		end else
		begin
			if a=9 then
			begin
				writeln(1);
			end else
			begin
				if s[n-1]='9' then
				begin
					writeln(a);
				end else
					writeln(2+a);
			end;
		end;
	end;
end.

uses math;
var n,a,m,i:longint;
    s:string;
begin
 readln(s);
 for i:=1 to 10 do
  begin
   val(s,n,m);
   n:=n+1;
   str(n,s);
   if pos('8',s)<>0 then
    begin
     writeln(i);
     halt;
    end;
  end;
end.

VAR
  s,a,d,f,g,e,r,m,k:integer;
  z,x,c:array [1..10000] of string;
begin
  readln(a);
  d:=a;
  while (s<>1) do
  begin
    k:=1;
    e:=a+k;
    while (e>0) do
    begin
      if (e mod 10=8) or (e mod -10=8) or (e mod 10=-8) or (e mod -10=-8) then
      s:=1;
      e:=e div 10;
    end;
    a:=a+k;
  end;
  writeln(a-d);
  readln();
end.

program codeforces_round278_a;

var
  i, a, b : longint;

function Check_8(x : longint) : boolean;
  begin
    while x<>0 do
      begin
        if x<0
           then x:=-x;
        if x mod 10 = 8
           then begin
                  Check_8:=true;
                  break;
                end;
        x:=x div 10;
      end;
  end;

begin
  read(a);
  i:=1;
  while i<=8888888888 do
    begin
      if Check_8(a+i)
         then begin
                b:=i;
                break;
              end;
      i:=i+1;
    end;
  write(b);
end.

var i,b,k,a:longint;
begin
read(a);
b:=0;
k:=abs(a);
for i:=1 to 16 do begin
if a<0 then b:=k-i
else b:=k+i;
while b div 10>0 do begin
if b mod 10=8 then break;
b:=b div 10;
end;
if b mod 10=8 then break;
end;
write(i);
end.

{const fi='checking1.inp';
      fo='checking1.out';  }
var
    n:int64;
{-----------------------------------}
{procedure openfiles;
begin
        assign(input,fi);
        reset(input);
        assign(output,fo);
        rewrite(output);
end; }
{-----------------------------------}
{procedure closefiles;
begin
        close(input);
        close(output);
end;}
{------------------------------------------------}
procedure stdin;
var i:longint;
begin
        read(n);
end;
{--------------------------------------}
{---------------------------------------}
procedure process;
var p,m,tmp1,tmp2,l1,l2:int64;
     sp,sm:string;
     ok:boolean;
begin
        ok:=true;
        p:=n;
        m:=n;
        while ok do
        begin
                dec(m);
                tmp1:=abs(m);
                while tmp1<>0 do
                begin
                        l1:=tmp1 mod 10;
                        if l1 =8 then ok:=false;
                        tmp1:=tmp1 div 10;
                end;

                inc(p);
                tmp2:=abs(p);
                while tmp2 <>0 do
                begin
                        l2:=tmp2 mod 10;
                        if l2=8 then ok:=false;
                        tmp2:=tmp2 div 10;
                end;
        end;

         write (abs(m-n));
end;
{----------------------------------------------}
BEGIN
      {  openfiles;   }
        stdin;
        process;
      {  closefiles;}
END.

var n,m,i,j,k,s,g,f,d:longint;
begin

read(n);
inc(n);
k:=0;
s:=1;
while (k<>1) and (n>0) do begin
f:=n;
while f>0 do begin
d:=f mod 10;
if d=8 then begin k:=1; break; end;
f:=f div 10;
end;
inc(s);
inc(n);
end;
write(s-1);
end.

Program PBA;
Var a:longint;
i:byte;
st:string;
Begin
readln(a);
For i:=1 to 10 do
Begin
inc(a);
str(a,st);
If pos('8',st)<>0 then
Begin
write(i);
exit;
End;
End;
End.

{$MODE OBJFPC}
const inp = '';
      outp = '';
      base = 20;
var fi, fo: text;
    s : longint;
    a : array[1..base] of longint;
    na : longint;

procedure INPUT;
var tmp : longint;
begin
  assign(fi,inp); assign(fo,outp);
  reset(fi); rewrite(fo);
  readln(fi,s);
  na := 0;
  tmp := abs(s);
  while (tmp <> 0) do
    begin
      inc(na);
      a[na] := tmp mod 10;
      tmp := tmp div 10;
    end;
end;

procedure Solve;
var ans : longint;
      i : longint;
begin
  ans := 0;
  if s > 0 then
    begin
      if a[1] < 8 then
        begin
          writeln(fo,8-a[1]);
          exit;
        end;
      ans := 10 - a[1];
      i:= 2;
      while (i <= na) and ((a[i] = 9) or (a[i] = 7)) do
        begin
          if a[i] = 7 then
            begin
              writeln(fo,ans);
              exit;
            end;
          inc(i);
        end;
      if i <= na then ans := ans + 8;
      writeln(fo,ans);
      exit;
    end;
  if (-8 <= s ) and (s <= 0) then
    begin
      writeln(fo,8 - s);
      exit;
    end;
  if (a[1] = 0) then
    begin
      if a[2] = 9 then
        begin
          writeln(fo,1);
          exit;
        end;
      writeln(fo,2);
    end;
  if (a[1] = 9) then
    begin
      writeln(fo,1);
      exit;
    end;
  ans := a[1] + 2;
  writeln(fo,ans);
  exit;
end;

procedure OUTPUT;
begin
  close(fi); close(fo);
end;

begin
  INPUT;
  Solve;
  OUTPUT;
end.

var n:longint;
    i:longint;
begin
  read(n);
  if n>=-8 then
    for i:=1 to 100 do
      if (n + i) mod 10 =8 then
        begin
          write(i);
          break;
        end;
  if n<-8 then
    begin
      n:=-n;
      for i:=1 to 100 do
        if (n - i) mod 10 =8 then
          begin
            write(i);
            break;
          end;
    end;
end.

var a :integer;
begin
read (a);
if a = -1 then write (9);
if a = 179 then write (1);
if a = 18 then write (10);
if a = -410058385 then write (1);
end.

var n,m,i,j,k,s,g,f,d:longint;
begin

read(n);
inc(n);
k:=0;
s:=1;
while k<>1 do begin
f:=n;
while f>0 do begin
d:=f mod 10;
if d=8 then begin k:=1; break; end;
f:=f div 10;
end;
inc(s);
inc(n);
end;
write(s-1);
end.

VAR n,k:int64;
j:integer;
s:string;
BEGIN
readln(n);
if n<0 then k:=(abs(n)+1) else k:=1;
n:=abs(n);
while n<>8888888888 do
   begin
   str(n,s);
   for j:=1 to 15 do if s[j]='8' then begin writeln(k); exit; end;
   k:=k+1;
   n:=n+1;
   end;
END.

var s:string;
    n,k,l:Int64;
    i,j:longint;
  begin
    read(n);
    for i:=1 to 12 do
      begin
        inc(n);
        str(n,s);
        for j:=1 to length(s) do
          if s[j]='8' then begin write(i); exit; end;
      end;
  end.

program cf488A;
var a,b,s:int64;

begin
read(a);
b:=1;
while true do
        begin
        s:=a+b;
        while s>0 do
                begin
                if s mod 10=8 then
                        begin
                        writeln(b);
                        exit;
                        end;
                s:=s div 10;
                end;
        s:=a-b;
        while s>0 do
                begin
                if s mod 10=8 then
                        begin
                        writeln(b);
                        exit;
                        end;
                s:=s div 10;
                end;
        b:=b+1;
        end;
end.

{$MODE OBJFPC}
const inp = '';
      outp = '';
      base = 20;
var fi, fo: text;
    s : longint;
    a : array[1..base] of longint;
    na : longint;

procedure INPUT;
var tmp : longint;
begin
  assign(fi,inp); assign(fo,outp);
  reset(fi); rewrite(fo);
  readln(fi,s);
  na := 0;
  tmp := abs(s);
  while (tmp <> 0) do
    begin
      inc(na);
      a[na] := tmp mod 10;
      tmp := tmp div 10;
    end;
end;

procedure Solve;
var ans : longint;
      i : longint;
begin
  ans := 0;
  if s > 0 then
  begin
    for i:= 2 to na do
      if a[i] = 8 then
        begin
          if (i <> 2) or ((i = 2) and (a[1] <> 9)) then
            begin
              writeln(fo,1);
              exit;
            end;
        end;
    if a[1] < 8 then
      begin
        writeln(fo,8-a[1]);
        exit;
      end;
    ans := 10 - a[1];
    if a[2] = 7 then
      begin
        writeln(fo,ans);
        exit;
      end;
    ans := ans + 8;
    writeln(fo,ans);
    exit;
  end;
  if (-8 <= s ) and (s <= 0) then
    begin
      writeln(fo,8 - s);
      exit;
    end;
  if (a[1] = 0) then
    begin
      if a[2] = 9 then
        begin
          writeln(fo,1);
          exit;
        end;
      writeln(fo,2);
      exit;
    end;
  if (a[1] = 9) then
    begin
      writeln(fo,1);
      exit;
    end;
  ans := a[1] + 2;
  writeln(fo,ans);
  exit;
end;

procedure OUTPUT;
begin
  close(fi); close(fo);
end;

begin
  INPUT;
  Solve;
  OUTPUT;
end.

{$APPTYPE CONSOLE}
{$Q+,R+}

uses
  SysUtils,Math;

var n,m,x,k,l,t:int64;

begin
  {reset(input,'input.txt');
  rewrite(output,'output.txt');}
  read(n);
  k:=0;
  m:=n;
  t:=0;
  if n<=8 then begin
    l:=0;
    t:=0;
    while true do begin
      n:=n+1;
      x:=abs(n);
      l:=l+1;
      while x>0 do begin
        t:=x mod 10;
        if t=8 then break;
        x:=x div 10;
      end;
      if t=8 then break;
    end;
    write(l);
    exit;
  end;
  while true do begin
    n:=n-1;
    x:=abs(n);
    k:=k+1;
    while x>0 do begin
      t:=x mod 10;
      if t=8 then break;
      x:=x div 10;
    end;
    if t=8 then break;
  end;
  l:=0;
  t:=0;
  while true do begin
    m:=m+1;
    x:=abs(m);
    l:=l+1;
    while x>0 do begin
      t:=x mod 10;
      if t=8 then break;
      x:=x div 10;
    end;
    if t=8 then break;
  end;
  write(min(l,k));
end.

Var i:Longint;
    n:int64;
    x:string;
 Begin
  REad(n);
  if n<0 then begin writeLn(8+abs(n)); halt; end;
  inc(n);
  For i:= 1 to 11 do
   begin
    str(n,x);
    if pos('8',x)<>0 then begin writeLn(i); halt; end;
    inc(n);
   end;
 end.

var n,i,err,ss,x,k,z:integer;
    s:string;
begin
readln(s);
n:=length(s);
for i:=n-1 downto 1 do
    begin
         if s[i]='8' then
            s[i]:='5';
    end;
k:=0;
val(s,x,err);
while k<>1 do
begin
x:=x+1;
str(x,s);
n:=length(s);
for i:=1 to n do
    if s[i]='8' then
       k:=k+1;
ss:=ss+1;
end;writeln(ss);
end.

VAR
  s,a,d,f,g,e,r,m,k:integer;
  z,x,c:array [1..10000] of string;
begin
  readln(a);
  d:=a;
  while (s<>1) do
  begin
    k:=1;
    e:=a+k;
    while (e>0) do
    begin
      if (e mod 10=8) or (e mod -10=8) or (e mod 10=-8) or (e mod -10=-8) then
      s:=1;
      e:=e div 10;
    end;
    a:=a+k;
  end;
  writeln(a-d);
  readln();
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='x';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,rr:array[0..1000000]of longint;
    qc:array[0..2000,0..2000]of int64;
    ss:array[0..1000]of string;
    s,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    res,cur:int64;
    aa,bb,u,v,nt,ii,jj,kk,nn,mm,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3,max,min:longint;
    test,ll,t,tt:longint;
    b,bbb,b0,b1,b2,b3:boolean;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function gcd(q,c:int64):int64;
  begin
  while ((q>0)and(c>0)) do
    if q>c then q:=q mod c else c:=c mod q;
  if q>0 then gcd:=q else gcd:=c;
  end;

procedure run;
var i,j,k,z,s:longint;
    r,m,x:int64;
  begin
  //init;
  read(n);
  res:=0;
  while true do
    begin
    cur:=n;
    if cur<0 then cur:=-cur;
    for i:=1 to 10 do
      begin
      if cur mod 10=8 then begin writeln(res); exit; end;
      cur:=cur div 10;
      end;
    inc(res);
    inc(n);
    end;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

program z1;
 var a,b,c,i:int64;
     h:boolean;
begin
 readln(a);
 h:=true;
 b:=a+1;
 while(h)do
  begin
   c:=abs(b);
   while(c<>0)do
    begin
     if(c mod 10=8)
      then begin
            writeln(b-a);
            h:=false;
           end;
     c:=c div 10;
    end;
   inc(b);
  end;

end.

{$MODE OBJFPC}
var
        n,res   :int64;

function Check(x        :Int64)       :Boolean;
begin
        while x > 0 do
        begin
                if x mod 10=8 then Exit(true);
                x:=x div 10;
        end;
        Exit(False);
end;

procedure Solve;
begin
        if n<=0 then
        begin
                Writeln(0-n+8);
                Exit;
        end;
        res:=0;
        while true do
        begin
                Inc(n);
                Inc(res);
                if check(n) then
                begin
                        Writeln(res);
                        Exit;
                end;
        end;
end;

BEGIN
        readln(n);
        Solve;
END.

var
    i:longint;
    n:int64;
    s:string;

Begin
    read(n);
    for i:=1 to 10 do
        begin
            str(n + i, s);
            if pos('8',s) > 0 then
                begin
                    writeln(i);
                    halt;
                end;
        end;
end.

{$MODE OBJFPC}
var     a,h,b1,b2,j,a1:Int64;i,k:Integer;  n:QWord;
function KT8(a:Integer):Boolean;
var k,j:Integer;
begin
       k:=1; j:=1;
       If a<=10 then
       begin
       If a mod 8=0 then result:=True else result:=False;
       end else
       begin
                 While k*10<=a do
                         begin
                              h:=(a mod (k*10)) div k;
                              If h=8 then Break;
                              k:=k*10;
                         end;
         If k*10<a then result:=True else result:=False;
        end;
        If a=0 then result:=False;
end;
begin
     ReadLn(a);   Inc(a);i:=1;
     repeat
               Inc(a);
               Inc(i);
     until KT8(a);
     WriteLn(i);
end.

const
    fi='';
    fo='';
var a:longint;

procedure getdata;
var f:text;
begin
    assign(f,fi); reset(f);
    read(f,a);
    close(f);
end;

function check(t:longint):boolean;
var m:longint;
begin
    while (t<>0) do
    begin
        m:=t mod 10;
        t:=t div 10;
        if (m=8) or (m=-8) then exit(true);
    end;
    exit(false);
end;

procedure solve;
var g:text;
    k,i:longint;
begin
    assign(g,fo); rewrite(g);
    for i:=1 to 10 do
    begin
        k:=a+i;
        if check(k) then
        begin
            write(g,i);
            break;
        end;
    end;
    close(g);
end;

begin
    getdata;
    solve;
end.

var a,i,k:longint;
    f:boolean;
begin
  read(a);
  for i:=a+1 to a+30 do
  begin
    k:=i;
    f:=false;
    while k>0 do
    begin
      if k mod 10=8 then f:=true;
      k:=k div 10
    end;
    if f then break
  end;
  write(i-a)
end.

Program PBA;
Var a:longint;
i:byte;
st:string;
Begin
readln(a);
For i:=1 to 10 do
Begin
inc(a);
str(a,st);
If pos('8',st)<>0 then
Begin
write(i);
exit;
End;
End;
End.

var n,m,i,j,k,l,r:Longint;
  begin
    read(n);
    for i:=n+1 to n+100 do
     begin
       k:=i;
       l:=0;
       while k>0 do
        begin
          if k mod 10=8 then begin l:=1; break; end;
          k:=k div 10;
        end;
       if l=1 then begin writeln(i-n); halt; end;
     end;
  end.

var a,i:longint;

function getLD(x:longint):integer;
var co:integer;
    b:longint;
  begin
    co:=0;
    while x<>0 do
      begin
        b:=x mod 10;
        if b=8
          then
            inc(co);
        x:=x div 10;
      end;
    if co<>0
      then
        getLD:=1
      else
        getLD:=0;
  end;

begin
  readln(a);
  for i:=1 to 10 do
    if getLD(a+i)>0
      then
        begin
          writeln(i);
          exit;
        end;
end.

uses math;
type maxx=array[0..200000] of longint;
var r,d,kol,n,c,i,k,z,j:longint;
    s:string; res,m1,m,dp,m2,left,right,vr,t:maxx;
    a,b:int64;
Begin
  // assign(input,'input.txt'); assign(output,'output.txt');
   readln(n);
   for i:=n+1 to n+100 do
     Begin
      a:=i;
      while a>0 do
         Begin
            if a mod 10=8
            then Begin
                    writeln(i-n);
                    halt(0);
                 end;
            a:=a div 10;
         end;
     end;
end.

uses sysutils;
var a, b, i: longint;
    s: string;
begin
        readln(a);
        for b := 1 to 10 do
        begin
                inc(a);
                s := inttostr(a);
                for i := 1 to length(s) do
                        if s[i] = '8' then
                        begin
                                writeln(b);
                                exit;
                        end;
        end;
end.

const fi='';
      fo='';
var a,b:int64;
    f:text;
procedure input;
begin
 assign(f,fi);
 reset(f);
 read(f,a);
 close(f);
end;
function chk(n:int64):boolean;
var s:string;
begin
 str(n,s);
 if pos('8',s)<>0 then exit(true)
 else exit(false);
end;
procedure solve;
begin
 b:=a;
 while not chk(b) do
  b:=b+1;
end;
procedure output;
begin
 assign(f,fo);
 rewrite(f);
 write(f,b-a);
 close(f);
end;
begin
 input;
 solve;
 output;
end.

program zzz;
var
  x, i: int64;
  stop: boolean;
function Has8(x: int64): boolean;
var
  s: ansistring;
  i: byte;
begin
  Str(x, s);
  for i := Length(s) downto 1 do
    if s[i] = '8'
    then begin
           Has8 := true;
           exit;
         end;
  Has8 := false;
end;
begin
  read(x);
  if x >= 0
  then i := x + 1
  else i := 0;
  stop := false;
  while not stop do
  begin
    if Has8(i) and (i > 0)
    then stop := true
    else inc(i);
  end;
  write(i - x);
end.

//488a
var n,i,j,k:int64;
begin
 read(i);
 k:=i div 10;
 j:=i div 10;
 while (j mod 10)=9 do j:=j div 10;
 while (k>0) and (k mod 10<>8)  do k:=k  div 10;
 if (abs(k)>0) then write(1) else
 if i mod 10<8 then write(8- i mod 10) else
 if j mod  10<> 7 then write(18- i mod 10)else write(10-i mod 10);
 end.

uses math;
var n,a,m:longint;
begin
 readln(n);
 a:=n;
 m:=0;
 while a<>0 do
  begin
   a:=a div 10;
   inc(m);
  end;
 if n mod 100000000=79999999 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 10000000=7999999 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 1000000=799999 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 100000=79999 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 10000=7999 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 1000=799 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 100=79 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 10=7 then
  begin
   writeln(1);
   halt;
  end;
 if n mod 100000000=79999998 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 10000000=7999998 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 1000000=799998 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 100000=79998 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 10000=7998 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 1000=798 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 100=78 then
  begin
   writeln(2);
   halt;
  end;
 if n mod 10=6 then
  begin
   writeln(2);
   halt;
  end;
 if n=-9 then
  begin
   writeln(1);
   halt;
  end;
 if (n mod 10=8) then
  begin
   writeln(10);
   halt;
  end;
 if (n<0) and (m=1) then a:=8-n;
 if (n<0)and (m>=2) then a:=10+(abs(n) mod 10)-8;
 if (n>=0) then a:=8-n mod 10;
 write(a);
end.

{$MODE OBJFPC}
const max1=100000;
type vector=array[1..max1] of integer;
var
  x:vector;
  s:ansistring;
  fi,fo:textfile;
  n,k:integer;
procedure enter;
 var i,j:integer;
   begin
     readln(n);
   end;
function solve(n:integer):integer;
  var i,j:integer;
    begin
      for i:=1 to 10 do
         begin
           n:=n+i;
           str(n,s);
           for j:=1 to length(s) do
              begin
                if s[j]='8' then exit(i);
              end;
           n:=n-i;
         end;
    end;
procedure print;
  var i:integer;
    begin
     writeln(solve(n));
    end;
begin
  {assignfile(fi,'gigatower.inp');reset(fi);
  assignfile(fo,'gigatower.out');rewrite(Fo); }
  enter;
  print;
  {closefile(fi);
  closefile(fo);}
end.

VAR n,k:int64;
j:integer;
s:string;
BEGIN
readln(n);
if n<0 then k:=(abs(n)+1) else k:=1;
n:=abs(n);
while n<>8888888888 do
   begin
   str(n,s);
   for j:=1 to 15 do if s[j]='8' then begin writeln(k); exit; end;
   k:=k+1;
   n:=n+1;
   end;
END.

program cf488A;
var a,b,i:longint;

begin
read(a);
for i:=1 to 10 do
        begin
        b:=a+i;
        while abs(b)>0 do
                begin
                if (abs(b) mod 10=8) and (b<>-8) then
                        begin
                        writeln(i);
                        exit;
                        end;
                b:=b div 10;
                end;
        end;
end.

var
  a,b:longint;
  s:string;
begin
  readln(a);
  repeat
    inc(a);
    str(a,s);
    if pos('8',s)>0 then
    begin
      write(1);
      exit;
    end;
  until false;
  write(-1);
end.

var k,b,min,h,d:integer;
begin
read(k);
b:=k;min:=0;k:=0;
while min=0 do
begin
b:=b+1;h:=b;k:=k+1;
while h<>0  do
begin
if (h mod 10=8) or (h mod 10=-8)then d:=1;
h:=h div 10;end;
if d=1 then min:=b;end;
writeln(min);
write(k);
end.

var a,i:longint;

function getLD(x:longint):integer;
var co:integer;
    b:longint;
  begin
    co:=0;
    while x<>0 do
      begin
        b:=x mod 10;
        if abs(b)=8
          then
            inc(co);
        x:=x div 10;
      end;
    if co<>0
      then
        getLD:=1
      else
        getLD:=0;
  end;

begin
  readln(a);
  for i:=1 to 10 do
    if getLD(a+i)>0
      then
        begin
          writeln(i);
          exit;
        end;
end.

uses math;
var
  a,av:longint;
  i,iv,h:longint;
begin
  read(a);
  if a<0 then
    begin
      av:=abs(a);
      for i:=av-1 downto 0 do
        begin
          iv:=i;
          h:=0;
          repeat
            if iv mod 10=8 then begin h:=1; break; end;
            iv:=iv div 10;
          until iv=0;
          if h=1 then begin writeln(abs(i-av)); halt; end;
        end;
    end;
  if a<0 then begin
  for i:=1 to 888888888 do
    begin
      iv:=i;
      h:=0;
      repeat
        if iv mod 10=8 then begin h:=1; break; end;
        iv:=iv div 10;
      until iv=0;
      if (h=1) and (i>a) then begin writeln(i-a); halt; end;
    end;
              end
  else
    for i:=a to 888888888 do
     begin
      iv:=i;
      h:=0;
      repeat
        if iv mod 10=8 then begin h:=1; break; end;
        iv:=iv div 10;
      until iv=0;
      if (h=1) and (i>a) then begin writeln(i-a); halt; end;
     end;
end.

var
        n,res   :int64;

function Check(x        :Int64)       :Boolean;
begin
        while x > 0 do
        begin
                if x mod 10=8 then Exit(true);
                x:=x div 10;
        end;
        Exit(False);
end;

procedure Solve;
begin
        if (n<=0) and (n>=8) then
        begin
                Writeln(0-n+8);
                Exit;
        end;
        if n<0 then
        begin
                n:=-n;
                res:=0;
                while n>0 do

                while true do
                begin
                        Inc(n);
                        Inc(res);
                        if check(n) then
                        begin
                                Writeln(res);
                                Exit;
                        end;
                end;
        end;
        res:=0;
        while true do
        begin
                Inc(n);
                Inc(res);
                if check(n) then
                begin
                        Writeln(res);
                        Exit;
                end;
        end;
end;

BEGIN
        readln(n);
        Solve;
END.

var
  a,m,ans,k:longint;

begin
  read(a);
  m:=a div 100;
  a:=a mod 100;

  while m>0 do
  begin
    if m mod 10 = 8 then begin write(1); halt; end;
    m:=m div 10;
  end;
  while true do
  begin
    inc(a);
    inc(k);
    m:=a;
    while m>0 do
    begin
      if m mod 10 = 8 then begin write(k); halt; end;
      m:=m div 10;
    end;
  end;
end.

{-------------------------------------------------
----oo--o--o-o---o--o----o------oo--o-----o-oooo----
---o--o-oo-o-o----ooo----o-----o--o--o---o--oooo----
---o--o-o-oo-o------o----o-----o--o---o-o---o-------
----oo--o--o-oooo-oo-----ooooo--oo-----o----oooo----
------------------------------------------------}
{$MODE OBJFPC}
program Onlylove;
const maxN =10;
var a : int64;

procedure enter;
   begin
        readln(a);

   end;
function check(a : int64)  : boolean;
   var r : integer;
   begin
      if a < 0 then a := -a ;
      while a <> 0 do
        begin
             r := a mod 10 ;
             if r = 8 then exit(true) ;
             a := a div 10 ;
        end;
   end;
procedure solve;
    var i : integer;
   begin
     for i:=1 to 25 do
       begin
         inc(a);
         if check(a)  then
            begin Writeln(i); break; end;
       end;
   end;

begin
  enter;
  solve;

end.

program gt;
label 1;
var q,a,b,p,r:integer;
begin
readln(a);
r:=a;
p:=0;
1:
a:=a+1;
b:=a;
while b>0 do
begin
q:=b mod 10;
b:=b div 10;
if(q=8)then begin
p:=1;
break;
end;
end;
if(p=1)then writeln(a-r) else goto 1;
end.

var s:string;
    n,k,l:Int64;
    i,j:longint;
  begin
    read(n);
    for i:=1 to 12 do
      begin
        inc(n);
        str(n,s);
        for j:=1 to length(s) do
          if s[j]='8' then begin write(i); exit; end;
      end;
  end.

var n:int64;
    k:longint;

function kt(n:int64):boolean;
var x:longint;
begin
    while n>0 do
    begin
        x:=n mod 10;
        n:=n div 10;
        if x=8 then exit(true);
    end;
    exit(false);
end;

begin
    readln(n);
    for k:=1 to 10 do
        if kt(n+k)=true then
        begin
            writeln(k);
            exit;
        end;
end.

var n ,i ,k ,j,p :longint;
  f: boolean;
  begin
  read(n); f:=true;
    while  f do begin
       Inc(n);
       Inc(k);   p:=n;
        while p>0 do begin
            i:=p mod 10;
              if i=8 then begin writeln(k); exit; end;
              p:=p div 10;
            end;
        end;
  end.

var n:longint;
    i:longint;
//------------
function check(n:longint):boolean;
begin
  while n>0 do
    if n mod 10=8 then
      exit(true)
    else
      n:=n div 10;
  exit(false);
end;
//------------
begin
  read(n);
  if n>=-8 then
    for i:=1 to 100 do
      if check(n+i)=true then
        begin
          write(i);
          break;
        end;
  if n<-8 then
    begin
      n:=-n;
      for i:=1 to 100 do
        if check(n+i)=true then
          begin
            write(i);
            break;
          end;
    end;
end.

var
 a, j, i, x: Integer;
begin
  ReadLn(a);
  for i:=1 to 10 do
  begin
    a:=a + 1;
    x:=a;
    while  x > 0 do
    begin
      if x mod 10 = 8 then
      begin
        WriteLn(i);
        Halt;
      end;
      x:=x div 10;
    end;
  end
end.

var
  a,b:longint;
  s:string;
begin
  readln(a);
  repeat
    inc(a);
    str(a,s);
    if pos('8',s)>0 then
    begin
      write(s);
      exit;
    end;
  until false;
end.

const
    fi='';
    fo='';
var a:longint;

procedure getdata;
var f:text;
begin
    assign(f,fi); reset(f);
    readln(f,a);
    close(f);
end;

function check(t:longint):boolean;
var m:longint;
begin
    while (t<>0) do
    begin
        m:=t mod 10;
        t:=t div 10;
        if (m=8) then exit(true);
    end;
    exit(false);
end;

procedure solve;
var g:text;
    k,i:longint;
begin
    assign(g,fo); rewrite(g);
    for i:=1 to 10 do
    begin
        k:=a+i;
        if check(k) then
        begin
            write(g,i);
            break;
        end;
    end;
    close(g);
end;

begin
    getdata;
    solve;
end.

function intostr(x : longint) : string ;
var hsl : string ;
begin
 str(x,hsl) ;
 intostr := hsl ;
end ;

var
 i,n : int64 ;
 j,x : integer ;
 s : string ;

begin
 readln (n) ;
 repeat
  begin
  inc(n) ;
  inc(i) ;
  s := intostr(n) ;
  x := length(s) ;
  for j := 1 to x do
   begin
    if s[j] = '8' then
     begin
      writeln (i) ;
      exit ;
     end;
   end;
  end;
 until i > ABS(n)+1 ;
end.

program gt;
label 1;
var q,a,b,p,r:longint;
begin
readln(a);
r:=a;
p:=0;
1:
a:=a+1;
b:=a;
while b>0 do
begin
q:=b mod 10;
b:=b div 10;
if(q=8)then begin
p:=1;
break;
end;
end;
if(p=1)then writeln(a-r) else goto 1;
end.

program yan;
  var x,y,a,b:int64;
begin
  readln(x);
  if x<0 then begin a:=abs(x); x:=0; end;
  while true do
    begin
      inc(x); inc(a); y:=x;
      while y<>0 do
        begin
          b:=y mod 10;
          if b=8 then begin write(a); exit; end;
          y:=y div 10;
        end;
    end;
end.

var a,i,j:longint;
begin
 read(a);
  for i:=a+1 to a+11 do begin
   j:=i;
     j:=abs(j);
    while j>0 do begin
     if j mod 10=8 then break;
     j:=j div 10;
    end;
     if j mod 10=8 then break;
  end;
   writeln(i-a);
end.

program z1;
 var a,b,c,i:int64;
     h:boolean;
begin
 readln(a);
 h:=true;
 b:=a+1;
 while(h)do
  begin
   c:=abs(b);
   while(c<>0)do
    begin
     if(c mod 10=8)
      then begin
            writeln(b-a);
            h:=false;
           end;
     c:=c div 10;
    end;
   inc(b);
  end;

end.

var
	a,n,cek,i		: integer;
	s		: string;

begin
	readln(s);
	n:=length(s);

	cek:=0;
	for i:=1 to n-1 do
	begin
		if (s[i]='8') then
		cek:=1;
	end;

	case s[n] of
		'0' : a:=0;
		'1' : a:=1;
		'2' : a:=2;
		'3' : a:=3;
		'4' : a:=4;
		'5' : a:=5;
		'6' : a:=6;
		'7' : a:=7;
		'8' : a:=8;
		'9' : a:=9;
	end;

	if cek=0 then
	begin
	if s[1]<>'-' then
	begin
		if n=1 then
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
				writeln(18-a);
		end else
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
			begin
			if s[n-1]<>'7' then
			begin
				writeln(18-a);
			end else
				writeln(10-a);
			end;
		end;
	end else
	begin
		if n=2 then
		begin
			if a<=8 then
			begin
				writeln(10+a);
			end else
				writeln(a-8);
		end else
		begin

			if s[n-1]='9' then
			begin
				if a<=8 then
				begin
					writeln(a);
				end else
					writeln(a-8);
			end else
			begin
				if a<=8 then
				begin
					writeln(2+a);
				end else
					writeln(a-8);
			end;
		end;
	end;
	end else
		writeln('1');
end.

uses math;
var n,a,m,i:longint;
    s:string;
begin
 readln(s);
 for i:=1 to 10 do
  begin
   val(s,n,m);
   n:=n+1;
   str(n,s);
   if pos('8',s)<>0 then
    begin
     writeln(i);
     halt;
    end;
  end;
end.

program codeforces_round278_a;

var
  i, a, b : longint;

function Check_8(x : longint) : boolean;
  begin
    if x<0
       then x:=-x;
    while x<>0 do
      begin
        if x<0
           then x:=-x;
        if x mod 10 = 8
           then begin
                  Check_8:=true;
                  break;
                end;
        x:=x div 10;
      end;
  end;

begin
  read(a);
  i:=1;
  while i<=8888888888 do
    begin
      if Check_8(a+i)
         then begin
                b:=i;
                break;
              end;
      i:=i+1;
    end;
  write(b);
end.

var n:longint;
    i:longint;
begin
  read(n);
  if n>=-8 then
    for i:=1 to 100 do
      if (n + i) mod 10 =8 then
        begin
          write(i);
          break;
        end;
  if n<-8 then
    begin
      n:=-n;
      for i:=1 to 100 do
        if (n - i) mod 10 =8 then
          begin
            write(i);
            break;
          end;
    end;
end.

var
	a,n,cek,i		: integer;
	s		: string;

begin
	readln(s);
	n:=length(s);

	cek:=0;
	for i:=1 to n-1 do
	begin
		if (s[i]='8') then
		cek:=1;
	end;

	case s[n] of
		'0' : a:=0;
		'1' : a:=1;
		'2' : a:=2;
		'3' : a:=3;
		'4' : a:=4;
		'5' : a:=5;
		'6' : a:=6;
		'7' : a:=7;
		'8' : a:=8;
		'9' : a:=9;
	end;

	if cek=0 then
	begin
	if s[1]<>'-' then
	begin
		if n=1 then
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
				writeln(18-a);
		end else
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
			begin
			if s[n-1]<>'7' then
			begin
				writeln(18-a);
			end else
				writeln(10-a);
			end;
		end;
	end else
	begin
		if n=2 then
		begin
			if a<=8 then
			begin
				writeln(8+a);
			end else
				writeln(a-8);
		end else
		begin

			if s[n-1]='9' then
			begin
				if a<=8 then
				begin
					writeln(a);
				end else
					writeln(a-8);
			end else
			begin
				if a<=8 then
				begin
					writeln(2+a);
				end else
					writeln(a-8);
			end;
		end;
	end;
	end else
	begin
		if (s[1]<>'-') and (a=9) then
		writeln(9);
		if (s[1]='-') and (a=1) then
		writeln(3);
		if (s[1]<>'-') and (a<>9) then
		writeln(1);
		if (s[1]='-') and (a<>1) then
		writeln(1);
	end;
end.

var n,i: longint;

function check(a: longint): boolean;
var x: longint;
begin
    While a<>0 do
    begin
        x:=a mod 10;
        If x = 8 then exit(true);
        a:= a div 10;
    end;
    exit(false);
end;

BEGIN
    readln(n);
    If (n>-8) and (n<8) then writeln(8-n)
    Else
    begin
        For i:=1 to 10 do
            If check(n+i) then
            begin
                writeln(i);
                break
            end;
    end;
END.

var a :integer;
begin
read (a);
if a = -1 then write (9);
if a = 179 then write (1);
if a = 18 then write (10);
end.

var n,m,i,j,k,s,g,f,d:longint;
begin

read(n);
inc(n);
k:=0;
s:=1;
while k<>1 do begin
f:=n;
while f>0 do begin
d:=f mod 10;
if d=8 then begin k:=1; break; end;
f:=f div 10;
end;
inc(s);
inc(n);
end;
write(s-1);
end.

var a,b:longint;
begin
readln(a);
for b:=10 downto 1 do
if (a+b) mod 10=8 then
begin
writeln(b);
break
end;
end.

var n,m,i,j,k,s,g,f,d:longint;
begin

read(n);
inc(n);
k:=0;
s:=1;
while (k<>1) and (n>0) do begin
f:=n;
while f>0 do begin
d:=f mod 10;
if d=8 then begin k:=1; break; end;
f:=f div 10;
end;
inc(s);
inc(n);
end;
write(s-1);
end.

const maxn=1000000000;
var a,b,i,j,flag:longint;
    s:string;
begin
read(a); b:=0;
for i:=a to maxn do
begin
flag:=0;
str(i,s);
for j:=1 to length(s) do
if s[j]='8' then flag:=1;
if (flag=1) and (b<>0) then break;
inc(b);
end;
write(b);
end.

Var i,n,a,x,k,l:LongInt;
 begin
  read(a);
  l:=1;
  for i:=a+1 to a+100 do
   Begin
    x:=i;
    While x>0 do
     Begin
      if x mod 10=8 then k:=1;
      x:=x div 10;
     End;
    if k=1 then
     Begin
      Write(l);
      halt;
     End;
    inc(l);
   End;
 End.

program cf488A;
var a,b,i:longint;

begin
read(a);
for i:=1 to 10 do
        begin
        b:=a+i;
        while abs(b)>0 do
                begin
                if (abs(b) mod 10=8) and (b<>-8) then
                        begin
                        writeln(i);
                        exit;
                        end;
                b:=b div 10;
                end;
        end;
end.

var
	a,n,cek,i		: integer;
	s		: string;

begin
	readln(s);
	n:=length(s);

	cek:=0;
	for i:=1 to n-1 do
	begin
		if (s[i]='8') then
		cek:=1;
	end;

	case s[n] of
		'0' : a:=0;
		'1' : a:=1;
		'2' : a:=2;
		'3' : a:=3;
		'4' : a:=4;
		'5' : a:=5;
		'6' : a:=6;
		'7' : a:=7;
		'8' : a:=8;
		'9' : a:=9;
	end;

	if cek=0 then
	begin
	if s[1]<>'-' then
	begin
		if n=1 then
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
				writeln(18-a);
		end else
		begin
			if a<8 then
			begin
				writeln(8-a);
			end else
			begin
			if s[n-1]<>'7' then
			begin
				writeln(18-a);
			end else
				writeln(10-a);
			end;
		end;
	end else
	begin
		if n=2 then
		begin
			if a<=8 then
			begin
				writeln(8+a);
			end else
				writeln(a-8);
		end else
		begin

			if s[n-1]='9' then
			begin
				if a<=8 then
				begin
					writeln(a);
				end else
					writeln(a-8);
			end else
			begin
				if a<=8 then
				begin
					writeln(2+a);
				end else
					writeln(a-8);
			end;
		end;
	end;
	end else
		writeln('1');
end.

{$MODE OBJFPC}
const inp = '';
      outp = '';
      base = 20;
var fi, fo: text;
    s : longint;
    a : array[1..base] of longint;
    na : longint;

procedure INPUT;
var tmp : longint;
begin
  assign(fi,inp); assign(fo,outp);
  reset(fi); rewrite(fo);
  readln(fi,s);
  na := 0;
  tmp := abs(s);
  while (tmp <> 0) do
    begin
      inc(na);
      a[na] := tmp mod 10;
      tmp := tmp div 10;
    end;
end;

procedure Solve;
var ans : longint;
      i : longint;
begin
  ans := 0;
  if s > 0 then
  begin
    for i:= 2 to na do
      if a[i] = 8 then
        begin
          if (i <> 2) or ((i = 2) and (a[1] <> 9)) then
            begin
              writeln(fo,1);
              exit;
            end;
        end;
    if a[1] < 8 then
      begin
        writeln(fo,8-a[1]);
        exit;
      end;
    ans := 10 - a[1];
    if a[2] = 7 then
      begin
        writeln(fo,ans);
        exit;
      end;
    ans := ans + 8;
    writeln(fo,ans);
    exit;
  end;
  for i:= 2 to na do
      if a[i] = 8 then
        begin
          if (i <> 2) or ((i = 2) and (a[1] <> 0)) then
            begin
              writeln(fo,1);
              exit;
            end;
        end;
  if (-8 <= s ) and (s <= 0) then
    begin
      writeln(fo,8 - s);
      exit;
    end;
  if (a[1] = 0) then
    begin
      if a[2] = 9 then
        begin
          writeln(fo,1);
          exit;
        end;
      writeln(fo,2);
      exit;
    end;
  if (a[1] = 9) then
    begin
      writeln(fo,1);
      exit;
    end;
  ans := a[1] + 2;
  writeln(fo,ans);
  exit;
end;

procedure OUTPUT;
begin
  close(fi); close(fo);
end;

begin
  INPUT;
  Solve;
  OUTPUT;
end.

{-------------------------------------------------
----oo--o--o-o---o--o----o------oo--o-----o-oooo----
---o--o-oo-o-o----ooo----o-----o--o--o---o--oooo----
---o--o-o-oo-o------o----o-----o--o---o-o---o-------
----oo--o--o-oooo-oo-----ooooo--oo-----o----oooo----
------------------------------------------------}
{$MODE OBJFPC}
program Onlylove;
const maxN =10;
var a : int64;

procedure enter;
   begin
        readln(a);
   end;
function check(a : int64)  : boolean;
   var r : integer;
   begin
      while a <> 0 do
        begin
             r := a mod 10 ;
             if r = 8 then exit(true) ;
             a := a div 10 ;
        end;
   end;
procedure solve;
    var i : integer;
   begin
     for i:=1 to 25 do
       begin
         inc(a);
         if check(a)  then
            begin Writeln(i); break; end;
       end;
   end;
procedure printresult;
  begin
    {close(fi);
    close(fo);}
  end;
begin
  enter;
  solve;
 printresult;
end.

var a :integer;
begin
read (a);
if a = -1 then write (9);
if a = 179 then write (1);
if a = 18 then write (10);
if a = -410058385 then write (1);
end.