#include <bits/stdc++.h>
using namespace std;
int main() {
    string s;
    cin >> s;
    
    int i = 0;
    long long res = 1;
    while(i < s.size()) {
        if(s[i] == 'T' or s[i] == 't') {
            res *= 3;
            i += 8;
        }
        else if(s[i] == 'd' or s[i] == 'D') {
            res *= 2;
            i += 5;
        }
        else if(s[i] == 'm' or s[i] == 'M') {
            res -= 1;
            i += 5;
        }
    }
    cout << res << endl;
    return 0;
}