#! /usr/bin/env python
import sys
import os

lastkey = None
curkey = None
sumvalue = 0
for line in sys.stdin:
    items = line.strip().split('\t', 1)

    if items[0] == curkey:
        sumvalue += int(items[1])
    else:
        if curkey != None:
            print curkey + "\t%d" % sumvalue
        curkey = items[0]
        sumvalue = int(items[1])
