#include #include #include using namespace std; const int beer_price = 42; int main() { int price, res = 0; string line; while( getline( cin, line ) ) { if( line[0] == '|' ) { res += int(line.length()) * beer_price; } else { stringstream line_stream(line); line = ""; line_stream >> price; line_stream.ignore( 2 ); line_stream >> line; if( line.length() > 0 ) res += int(price * line.length()); else res += price; } } if ( res % 10 >= 5 ) res += (10 - res % 10); else res -= res % 10; cout << res << ",-" << endl; return 0; }