#include <bits/stdc++.h>
using namespace std;
int n, x[5], y[5];
struct state {
  int bx, by, sx, sy;
  bool operator==(const state &o) const {
    return (bx == o.bx) && (by == o.by) && (sx == o.sx) && (sy == o.sy);
  }
};
class h {
 public:
  size_t operator()(const state &a) const {
    return hash<int>()(a.bx) ^ (hash<int>()(a.by) << 1) ^
           (hash<int>()(a.sx) << 2) ^ (hash<int>()(a.sy) << 3);
  }
};
unordered_map<state, int, h> dp;
int getAns(int bx, int by, int sx, int sy) {
  if ((bx == 0) && (by == 0)) {
    if ((sx > 0) || (sy > 0))
      return 0;
    else if ((sx == 0) && (sy == 0))
      return 1;
  } else if (dp.count((state){bx, by, sx, sy}))
    return dp[(state){bx, by, sx, sy}];
  int i, j, ans = 0;
  for (i = 0; i < (1 << n); i++) {
    int bx2 = bx, by2 = by, sx2 = sx, sy2 = sy;
    for (j = 0; j < n; j++) {
      if (i & (1 << j)) {
        sx2 -= x[j], sy2 -= y[j];
        if (x[j] > 0) bx2 -= x[j];
        if (y[j] > 0) by2 -= y[j];
      }
    }
    if ((bx2 >= 0) && (by2 >= 0) && !(sx2 & 1) && !(sy2 & 1)) {
      ans += getAns(bx2 / 2, by2 / 2, sx2 / 2, sy2 / 2);
      if (ans >= 998244353) ans -= 998244353;
    }
  }
  dp[(state){bx, by, sx, sy}] = ans;
  return ans;
}
int main() {
  int i;
  int m;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%d %d", &x[i], &y[i]);
  printf("%d\n", (getAns(m, m, 0, 0) + 998244353 - 1) % 998244353);
  return 0;
}
