#include <iostream>
#include <string>
using namespace std;
int main() {
int number[26];
for (int i = 0; i < 26; cin >> number[i++]) { }
string s;
cin.ignore();
getline (cin, s);
int row = 1;
int wideth = 0;
for (int i = 0; i < s.size(); i++) {
int j = s[i] - 'a';
wideth += number[j];
if (wideth > 100) {
row++;
wideth = number[j];
}
}
cout << row << ' ' << wideth;
return 0;
}

京公网安备 11010502036488号