#include <bits/stdc++.h>
using namespace std;
#define R(i, a, b) for (int i = (a); i < (b); ++i)
#define L(i, a, b) for (int i = (b) - 1; i >= (a); --i)
using i64 = long long;
constexpr int M = 998244353;
struct mint {
  int x;
  const int operator()() {
    return x;
  }
  mint(int _x = 0) : x(_x) {}
};
mint operator+(const mint &a, const mint &b) {
  const int x = a.x + b.x;
  return x < M ? x : x - M;
}
mint operator-(const mint &a, const mint &b) {
  const int x = a.x - b.x;
  return x < 0 ? x + M : x;
}
mint operator*(const mint &a, const mint &b) {
  return i64(a.x) * b.x % M;
}
mint &operator+=(mint &a, const mint &b) {
  a = a + b; return a;
}
mint &operator*=(mint &a, const mint &b) {
  a = a * b; return a;
}
mint pw(mint a, int x = M - 2) {
  mint res = 1;
  for (; x; x >>= 1, a *= a) if (x & 1) res *= a;
  return res;
}
constexpr int n = 15, ns = 1 << 15, nc = 225;
mint f[n + 1][nc][ns], res[nc];
int main() {
  // freopen("geometry.in", "r", stdin); freopen("geometry.out", "w", stdout);
  ios::sync_with_stdio(false); cin.tie(0);
  f[0][0][0] = 1;
  R(i, 0, n) R(c, 0, nc) R(s, 0, ns) if (f[i][c][s]()) {
    R(t, 0, ns) if ([&]()->bool {
      R(j, 0, n) if (t >> j & 1) {
        if (i < 7 and j > 7 + i) return false;
        if (i > 7 and j < i - 7) return false;
        if (j and (t >> (j - 1) & 1)) return false;
        if (s >> j & 1) return false;
        if (j and (s >> (j - 1) & 1)) return false;
      }
      return true;
    }()) f[i + 1][c + __builtin_popcount(t)][t] += f[i][c][s];
  }
  R(c, 0, nc) R(s, 0, ns) res[c] += f[n][c][s];
  L(c, 0, nc) if (res[c]()) {
    cout << c << ' ' << res[c]() << '\n'; break;
  } 
  return 0;
}