#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, sum = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (s.size() == 4) sum += 6;
    if (s.size() == 10) sum += 8;
    if (s.size() == 12) sum += 12;
    if (s.size() == 11 && s[0] == 'T') sum += 4;
    if (s.size() == 11 && s[0] == 'I') sum += 20;
  }
  cout << sum;
  return 0;
}
