#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
int n, m, x[5], y[5], f[40][25][25][25][25][2][2], px[40], py[40], nx[40],
    ny[40];
void inc(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  for (int s = 0; s < (1 << n); s++)
    for (int i = 0; i < n; i++)
      if (s >> i & 1) {
        if (x[i] < 0)
          nx[s] -= x[i];
        else
          px[s] += x[i];
        if (y[i] < 0)
          ny[s] -= y[i];
        else
          py[s] += y[i];
      }
  f[0][0][0][0][0][0][0] = 1;
  int i;
  for (i = 0; (1 << i) <= m; i++)
    for (int cpx = 0; cpx <= px[(1 << n) - 1]; cpx++)
      for (int cpy = 0; cpy <= py[(1 << n) - 1]; cpy++)
        for (int cnx = 0; cnx <= nx[(1 << n) - 1]; cnx++)
          for (int cny = 0; cny <= ny[(1 << n) - 1]; cny++)
            for (int cs = 0; cs < 2; cs++)
              for (int ct = 0; ct < 2; ct++) {
                if (!f[i][cpx][cpy][cnx][cny][cs][ct]) continue;
                for (int s = 0; s < (1 << n); s++) {
                  int npx = cpx + px[s], npy = cpy + py[s], nnx = cnx + nx[s],
                      nny = cny + ny[s];
                  if ((npx ^ nnx) & 1 || (npy ^ nny) & 1) continue;
                  int ns = cs;
                  if ((npx & 1) > (m >> i & 1)) ns = 1;
                  if ((npx & 1) < (m >> i & 1)) ns = 0;
                  int nt = ct;
                  if ((npy & 1) > (m >> i & 1)) nt = 1;
                  if ((npy & 1) < (m >> i & 1)) nt = 0;
                  inc(f[i + 1][npx >> 1][npy >> 1][nnx >> 1][nny >> 1][ns][nt],
                      f[i][cpx][cpy][cnx][cny][cs][ct]);
                }
              }
  cout << (f[i][0][0][0][0][0][0] - 1 + mod) % mod;
  return 0;
}
