#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define DEBUG 1
#ifdef DEBUG
#define OUT(x) cerr << (#x) << '=' << (x) << endl
#define OUT2(c) cerr << (#c) << " = {"; for (auto it = (c).begin(); it != (c).end(); ++it) cerr << (it == (c).begin() ? "" : ", ") << *it; cerr << "}" << endl;
#else
#define OUT(x)
#define OUT2(c)
#endif
const int INF = 1e18;
void solve() {
int n; cin >> n;
vector<array<int, 3>> spray(n);
for(int i = 0; i < n; i++){
cin >> spray[i][0] >> spray[i][1] >> spray[i][2];
}
sort(spray.begin(), spray.end());
vector<int> streak(9, -INF);
vector<int> ans(2, 0);
auto team = [&](int x){
if(1 <= x && x <= 4) return 0;
else return 1;
};
for(auto &[t, a, b] : spray){
int ta = team(a), tb = team(b);
if(ta == tb) continue;
if(t - streak[a] <= 10){
ans[ta] += 150;
}
else{
ans[ta] += 100;
}
streak[a] = t;
}
cout << ans[0] << " " << ans[1] << '\n';
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int tt; tt = 1;
while (tt--) {
solve();
}
}