﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace P03NetherRealms
{
    class Program
    {
        static void Main(string[] args)
        {
            var deamons = Console.ReadLine().Split(new char[] { ' ', ',', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries).ToArray().OrderBy(x => x);

            foreach (var deamon in deamons)
            {
                decimal damage = DamageCalc(deamon);
                double health = HealthCalc(deamon);
                Console.WriteLine($"{deamon} - {health} health, {damage:F2} damage");
            }
        }

        private static decimal DamageCalc(string s)
        {
            decimal damage = 0;
            string digits = @"[\-\+]?[\d]+(?:[\.]*[\d]+|[\d]*)";
            Regex regex = new Regex(digits);
            MatchCollection matches = regex.Matches(s);
            foreach (var item in matches)
            {
                damage += decimal.Parse(item.ToString());
            }
            var countMulty = s.Count(x => x == '*');
            for (int i = 0; i < countMulty; i++)
            {
                damage *= 2;
            }
            var countDiv = s.Count(x => x == '/');
            for (int i = 0; i < countDiv; i++)
            {
                damage /= 2;
            }
            return damage;
        }

        private static double HealthCalc( string s)
        {
            string demonHealthPattern = @"[^\d\.\+\-\*\/\s\,]";
            Regex regex = new Regex(demonHealthPattern);
            MatchCollection collection = regex.Matches(s);
            double health = 0;
            foreach (Match str in collection)
            {
                foreach (char c in str.ToString())
                {
                    health += (int)c;
                }
            }
            return health;
        }
    }
}
