# -*- coding:utf-8 -*- if __name__ == "__main__": n = input() ans1 , ans2 = 0,0 for i in xrange(n): t, s = raw_input().split() t = int(t) cantype = 12 * t // 1000 if len(s) > cantype: ans1 += cantype ans2 += len(s) - cantype else: ans1 += len(s) print "%d %d" % (ans1,ans2)