#include <bits/stdc++.h>
using namespace std;
int n, m, x[5], y[5];
int dnx[1 << 5], dpx[1 << 5], dny[1 << 5], dpy[1 << 5];
int f[31][(4 * 5) + 1][(4 * 5) + 1][(4 * 5) + 1][(4 * 5) + 1][2][2];
inline void upd(int &a, int b) {
  a += b;
  a -= (a >= 998244353 ? 998244353 : 0);
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%d%d", &x[i], &y[i]);
  for (int i = 0; i < 1 << n; ++i)
    for (int j = 0; j < n; ++j)
      if (i >> j & 1) {
        (x[j] < 0 ? dnx[i] : dpx[i]) += abs(x[j]);
        (y[j] < 0 ? dny[i] : dpy[i]) += abs(y[j]);
      }
  f[0][0][0][0][0][0][0] = 1;
  int i = 0;
  for (; 1 << i <= m; ++i)
    for (int nx = 0; nx <= (4 * 5); ++nx)
      for (int px = 0; px <= (4 * 5); ++px)
        for (int ny = 0; ny <= (4 * 5); ++ny)
          for (int py = 0; py <= (4 * 5); ++py)
            for (int cx = 0; cx <= 1; ++cx)
              for (int cy = 0; cy <= 1; ++cy) {
                int val = f[i][nx][px][ny][py][cx][cy];
                if (val == 0) continue;
                for (int s = 0; s < 1 << n; ++s) {
                  int nnx = nx + dnx[s], npx = px + dpx[s];
                  int nny = ny + dny[s], npy = py + dpy[s];
                  if ((nnx & 1) != (npx & 1) || (nny & 1) != (npy & 1))
                    continue;
                  int ncx = ((npx & 1) > (m >> i & 1)   ? 1
                             : (npx & 1) < (m >> i & 1) ? 0
                                                        : cx);
                  int ncy = ((npy & 1) > (m >> i & 1)   ? 1
                             : (npy & 1) < (m >> i & 1) ? 0
                                                        : cy);
                  upd(f[i + 1][nnx >> 1][npx >> 1][nny >> 1][npy >> 1][ncx]
                       [ncy],
                      val);
                }
              }
  printf("%d\n", (f[i][0][0][0][0][0][0] - 1 + 998244353) % 998244353);
  return 0;
}
