{$apptype console}

function rep (n: integer; c: char): string;
var s: string; i: integer;
begin
  s := '';
  for i := 1 to n do s := s + c;
  rep := s;
end;

var n: integer;
begin
  readln (n);
  case n of
    0: writeln ('1');
    1: writeln ('0');
    else writeln (rep (n mod 2, '4') + rep (n div 2, '8'));
  end;
end.
