#include <iostream>
#include <string>
#include <ctime>
#include <map>
#include <limits>
using namespace std;

template< char C >
std::istream& skip( std::istream& in )
{
    return in.ignore( std::numeric_limits< std::streamsize >::max(), C );
}

struct opt // opt für optional; liest ein int, wenn eine Zahl kommt, sonst wird der Wert =0 gesetzt
{
    explicit opt( int& value )
        : value_( value )
    {}
    friend std::istream& operator>>( std::istream& in, opt & o ) // Lesefunktion für den Wrapper 'opt'
    {
        char c;
        if( in >> c && in.putback( c ) ) // lese das nächste Zeichen 'c' und stelle es auch gleich zurück!
        {
            if( ('0' <= c && c <= '9') || c == '-' || c == '+' ) // könnte eine Zahl sein
                in >> o.value_; // dann lese die Zahl
            else
                o.value_ = 0; // sonst definiert auf 0 setzen
        }
        return in;
    }
private:
    int& value_;
};

int main()
{
    map<string, int> m; // Variablen so lokal wie möglich anlegen
	
	std::istream & log = std::cin;
	
	string name1;
    int value;
    string dpsorheal;                                                            //<-- hier optional lesen -->
    // Format:                " <Zeit>    |   <name1>  |   <name2>   |<skillname> |       [<value>]          |   <dpsorheal>  | ..Rest..EOL"
    while( getline( getline( log >> skip<'|'>, name1, '|' ) >> skip<'|'> >> skip<'|'> >> opt(value) >> skip<'|'>, dpsorheal, '|' ) >> skip<'\n'> )
    { // usw.
		m[name1]+=value;
	}
	
	for(map<string, int>::iterator iter=m.begin(); iter!=m.end(); ++iter)
    {
        cout << iter->first << " = " << iter->second << endl;
    }
	
	return 0;
}

