Загрузка данных


weights = {
    "scan": 2,
    "carry": 3,
    "repair": 5,
    "patrol": 1
}

n = int(input())
total = 0

for _ in range(n):
    m_type, urgency = input().split()
    total += weights[m_type] + int(urgency)

print(total)