#include <bits/stdc++.h>
int main() {
  int n;
  long s = 0;
  scanf("%d", &n);
  char c, s1[100];
  while (n--) {
    scanf(" %c", &c);
    scanf("%s", s1);
    if (c == 'T') s += 4;
    if (c == 'C') s += 6;
    if (c == 'O') s += 8;
    if (c == 'D') s += 12;
    if (c == 'I') s += 20;
  }
  printf("%ld", s);
}
