# coding:utf-8 counter = int(input()) taro_speed = 12 taro_mSpeed = taro_speed / 1000 ansTyping = 0 ansMissTyping = 0 for i in range(counter): time, strings = map(str, input().split()) time = int(time) if taro_mSpeed * time >= len(strings): ansTyping += len(strings) else: ansTyping += int(taro_mSpeed * time) ansMissTyping += len(strings) - int(taro_mSpeed * time) print(str(ansTyping) + " " + str(ansMissTyping))