#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<29;

int dx[4], dy[4];
bool ba[4][4];

int rec(int x,int y) {
  for (;y<4; ++x) {
    if (x==4) {
      y++;x=0;
    }
    if (!ba[x][y]) {
      break;
    }
  }
  if (y==4) return 1;

  // printf("%d,%d\n", x,y);
  // REP(i,4) {
  //   REP(j,4)
  //     cout << ba[j][i] << " ";
  //   cout<< endl;
  // }
  
  ba[x][y] = 1;
  int res = 0;
  REP(i,4) {
    int xx = x+dx[i];
    int yy = y+dy[i];
    if (xx<0||xx>=4||yy<0||yy>=4) continue;
    if (ba[xx][yy]) continue;
    ba[xx][yy] = 1;
    res += rec(x+1, y);
    ba[xx][yy] = 0;
  }
  ba[x][y] = 0;
  return res;
}

int main() {
  while(cin >> dx[0], dx[0]<=3) {
    REP(i,4) {
      if (i)cin >> dx[i];
      cin >> dy[i];
    }
    memset(ba,0,sizeof(ba));
    cout << rec(0,0) << endl;
  }
}