#include <bits/stdc++.h>
using namespace std;
long double pi = 2.0 * acos(0.0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
long long int N;
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int a, b, c, d, i, j, k, first, r, x, y, z;
  long long int n, m, p, q, t, l;
  string S;
  a = b = c = d = i = j = k = first = r = x = y = z = n = m = p = q = t = l = 0;
  long long int A[10][10][10][10];
  queue<long long int> Q;
  memset(A, 0, sizeof(A));
  cin >> S;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      for (k = 0; k < 10; k++) {
        Q.push(k);
        while (!(Q.empty())) {
          x = Q.front();
          if (i != 0 && A[i][j][k][(x + i) % 10] == 0) {
            A[i][j][k][(x + i) % 10] = A[i][j][k][x] + 1;
            Q.push((x + i) % 10);
          }
          if (j != 0 && A[i][j][k][(x + j) % 10] == 0) {
            A[i][j][k][(x + j) % 10] = A[i][j][k][x] + 1;
            Q.push((x + j) % 10);
          }
          Q.pop();
        }
      }
    }
  }
  n = S.size();
  first = 0;
  for (i = 0; i < 10; i++) {
    for (j = 0; j < 10; j++) {
      r = 0;
      for (k = 0; k < n - 1; k++) {
        if (S[k] == S[k + 1]) {
          if (i == 0 || j == 0) {
            r += 1;
            continue;
          }
        }
        if (A[i][j][S[k] - '0'][S[k + 1] - '0'] == 0) {
          r = n - 2;
          break;
        } else {
          r += A[i][j][S[k] - '0'][S[k + 1] - '0'];
        }
      }
      cout << r - (n - 1) << " ";
    }
    cout << "\n";
  }
  return 0;
}
