#include <bits/stdc++.h>
using namespace std;
bool gimme(long long x) {
  while (x != 0) {
    if (x % 10 == 8 || x % 10 == -8) {
      return 1;
    }
    x = x / 10;
  }
  return 0;
}
int main() {
  long long n, i = 1;
  cin >> n;
  while (gimme(n + i) == 0) {
    i++;
  }
  cout << i;
  return 0;
}
