#include <iostream>
#include <string>

void solve() {
    int n;
    std::cin >> n;

    int ok = 0, ng = 0;
    while (n--) {
        int t;
        std::string s;
        std::cin >> t >> s;
        int l = s.length();

        int u = std::min(t * 12 / 1000, l);
        ok += u, ng += l - u;
    }

    std::cout << ok << " " << ng << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}