import std.algorithm, std.array, std.range; import std.string, std.conv; import std.stdio, std.typecons; void main() { auto n = readln.chomp.to!int; auto tsi = iota(n).map!((i) { auto s = readln.split; return tuple(s[0].to!int, s[1]); }); auto ai = tsi.map!((ts) { auto t = ts[0]; auto s = ts[1].length.to!int; auto u = min(t * 12 / 1000, s); auto w = max(s - u, 0); return tuple(u, w); }); auto r = reduce!((a, b) { return tuple(a[0] + b[0], a[1] + b[1]); })(tuple(0, 0), ai); writeln(r[0], " ", r[1]); }