/*
* * author: attacker
* * created: 01.03.2026 11:00:24
*/
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "algo/debug.h"
#else
#define debug(...) 42
#endif
#define mt_rng mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int n;
cin >> n;
vector<tuple<int, int, int>> a(n);
for (auto& [t, p1, p2] : a) {
cin >> t >> p1 >> p2;
--p1, --p2;
}
sort(a.begin(), a.end());
const int inf = int(1e9);
vector<int> when(8, -inf);
int sc_1 = 0, sc_2 = 0;
for (int i = 0; i < n; i++) {
auto [t, p1, p2] = a[i];
int last = when[p1];
int num = 100 + (t - last <= 10) * 50;
(p1 <= 3 ? sc_1 += num : sc_2 += num);
when[p1] = t;
}
cout << sc_1 << ' ' << sc_2 << '\n';
return 0;
}