#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k = 0;
  cin >> n;
  long long m = n;
  for (int i = 1; i < INT_MAX; i++) {
    k = m + i;
    k = abs(k);
    while (k > 0) {
      int c = k % 10;
      k = k / 10;
      if (c == 8) {
        cout << i;
        cin >> n;
        return 0;
      }
    }
  }
}
