#include<bits/stdc++.h>
#include <unordered_map>
#define fi first
#define se second
#define pb push_back

using namespace std;

/*
debug用
*/
// #define debug(args...) {}
#define debug(args...) { \
     string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); \
     stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); cout << '\n';}
void err(istream_iterator<string> it){}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << ' ';
    err(++it, args...);
}

#define int long long
#define double long double
typedef pair<int, int> PII;
// const int N = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;
// const int mod = 1e9 + 7;
// int dx[4] = {0, 0, 1, -1};
// int dy[4] = {1, -1, 0, 0};
// int dx[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
// int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
    
void whx()
{
    unordered_map<char, int> mp;
    for (char ch = 'a'; ch <= 'z'; ch ++ )
    {
        cin >> mp[ch];
    }
    string s; cin >> s;
    int ans = 0, cnt = 0;
    for (int i = 0; i < s.size(); i ++ )
    {
        if (cnt + mp[s[i]] > 100)
        {
            cnt = mp[s[i]];
            ans ++;
        }
        else cnt += mp[s[i]];
    }
    cout << ans + 1 << " " << cnt << "\n";
}

signed main()   
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int _; _ = 1;
    // cin >> _;
    while (_ -- ){ whx();}
    return 0;
}

/*
    zzz
    <⌒/ヽ-、__
  /<_/____/
   ̄ ̄ ̄ ̄ ̄ ̄
*/