#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    int r = 1;

    for (int i = 0; i < 3; i++) {
        string s;
        cin >> s;

        int k = 0;
        if (s != "NONE") {
            k = 1;
            for (const auto& c : s) {
                if (c == ',') k++;
            }
        }
        k = 16 - k;
        r *= k * k;
    }

    cout << r << endl;

    return 0;
}