#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	vector<string> s(3);
	rep(i,3) cin >> s.at(i);
	int ans=1;
	rep(i,3){
		if(s.at(i)=="NONE") ans*=(int)pow(2,8);
		else{
			int k=16-(s.at(i).size()/2+1);
			ans*=k*k;
		}
	}
	cout << ans << endl;
}