#include<stdio.h>

char bo[4][4];
int xy4[8];
int check(int x,int y){
  return x*y>-1&&x<4&&y<4;
}
int count(int x,int y,int num){
  int i,j,k,total;
  if(num==8) return 1;
  for(i=0,total=0;i<4;i++){
    if(check(x+xy4[i*2],y+xy4[i*2+1])&&bo[y+xy4[i*2+1]][x+xy4[i*2]]==0){
      bo[y][x]=bo[y+xy4[i*2+1]][x+xy4[i*2]]=num+1;
      for(j=y;j<4;j++)
	for(k=j==y?x:0;k<4;k++)
	  if(bo[j][k]==0) goto find;
    find:
      total+=count(k,j,num+1);
      bo[y][x]=bo[y+xy4[i*2+1]][x+xy4[i*2]]=0;
    }
  }
  return total;
}
int main(){
  int i;
  while(1){
    scanf("%d",xy4);
    if(xy4[0]>4) break;
    for(i=1;i<8;i++) scanf(" %d",xy4+i);
    printf("%d\n",count(0,0,0));
  }
  return 0;
}