#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <numeric>
#include <map>
#include <vector>
#include <string>
#include <vector>
#include <cassert>
#include <cmath>
#include <cctype>
#include <queue>
#include <algorithm>
#include <memory>
#include <memory.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P,P> P2;
const int INF = 1 << 30;
const double EPS = 1E-9;

P p[4];
vector<P> mv;
bool used[4][4];

int calc(int p){
	while(p < 16 && used[p/4][p%4]) p++;
	if(p == 16){
		return 1;
	}
	int count = 0;
	used[p/4][p%4] = true;
	int y = p / 4;
	int x = p % 4;
	for(int i = 0; i < (int)mv.size(); i++){
		int x2 = x + mv[i].first;
		int y2 = y + mv[i].second;
		if(x2 >= 0 && x2 < 4 && y2 >= 0 && y2 < 4 && !used[y2][x2]){
			used[y2][x2] = true;
			count += calc(p+1);
			used[y2][x2] = false;
		}
	}
	used[y][x] = false;
	return count;
}

int main(){ 
	while(cin >> p[0].first && p[0].first < 5){
		cin >> p[0].second;
		mv.clear();
		for(int i = 1; i < 4; i++) cin >> p[i].first >> p[i].second;
		for(int i = 0; i < 4; i++){
			mv.push_back(p[i]);
		}
		memset(used, false, sizeof(used));
		cout << calc(0) << endl;
	}
}