#include <bits/stdc++.h>   using namespace std;   template <class T>   void read(T &x) {     int f = 0;     x = 0;     char ch = getchar();     for (; !isdigit(ch); ch = getchar()) f |= (ch ==  - );     for (; isdigit(ch); ch = getchar()) x = x * 10 + ch -  0 ;     if (f) x = -x;   }   const int N = 20, mod = 998244353;   int f[N][N][N][N][2][2];   int g[N][N][N][N][2][2];   int x[N], y[N], n, m;   void add(int &x, int y) { x = (x + y >= mod ? x + y - mod : x + y); }   int main() {     read(n), read(m);     for (int i = (1); i <= (n); i++) read(x[i]), read(y[i]);     f[0][0][0][0][0][0] = 1;     for (; m; m >>= 1) {       memset(g, 0, sizeof g);       for (int px = 0; px < (N); px++)         for (int nx = 0; nx < (N); nx++)           for (int py = 0; py < (N); py++)             for (int ny = 0; ny < (N); ny++)               for (int fx = 0; fx < (2); fx++)                 for (int fy = 0; fy < (2); fy++) {                   int t = f[px][nx][py][ny][fx][fy];                   if (!t) continue;                   for (int s = 0; s < (1 << n); s++) {                     int Px = px, Nx = nx, Py = py, Ny = ny;                     for (int i = (1); i <= (n); i++)                       if (s >> (i - 1) & 1) {                         Px += max(x[i], 0);                         Nx -= min(x[i], 0);                         Py += max(y[i], 0);                         Ny -= min(y[i], 0);                       }                     if ((Px & 1) != (Nx & 1) || (Py & 1) != (Ny & 1)) continue;                     int gx =                         ((Px & 1) < (m & 1) ? 0 : ((Px & 1) > (m & 1) ? 1 : fx));                     int gy =                         ((Py & 1) < (m & 1) ? 0 : ((Py & 1) > (m & 1) ? 1 : fy));                     Px >>= 1, Nx >>= 1, Py >>= 1, Ny >>= 1;                     add(g[Px][Nx][Py][Ny][gx][gy], t);                   }                 }       swap(f, g);     }     cout << ((f[0][0][0][0][0][0] + mod - 1) % mod) << endl;     return 0;   }   