i,j;char a[7][7];q(int*a,int*b){return*b-*a;}x(char a[][7],int t){int b[6]={},f=1,i=0,j;char c[6][7];if(t){for(;f;i+=f)for(j=0;f&&++j<6;f-=a[i][j]==45);memcpy(c,a,42);c[i][j]=111;c[j][i]='x';f=x(c,t-1);c[i][j]='x';c[j][i]=111;j=x(c,t-1);return f*b&&b[i-1]-b[i]);return f;}main(t){for(;i<7;j=!++i)for(gets(a[i]);j<7;t+=a[i][j++]==45);i=!printf("%d",x(a[1],t/2));}