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