// SumBigDecimalHex.java

import java.math.BigDecimal;
import java.math.BigInteger;

public class SumBigDecimalHex {
  public static void main(String[] args) {
      BigDecimal sum = new BigDecimal("0");
      for (String argument : args) {
          StringBuilder number = new StringBuilder();
          for (char c : argument.toCharArray()) {
              if (!Character.isWhitespace(c)) {
                  number.append(c);
              } else {
                  sum = sum.add(parseNumber(number));
                  number = new StringBuilder();
              }
          }

          sum = sum.add(parseNumber(number));
      }

      System.out.println(sum);
  }


  static BigDecimal parseNumber(StringBuilder number) {
      if (!number.isEmpty()) {
          String numberString = number.toString().toLowerCase();
          if (numberString.startsWith("0x")) {
              numberString = numberString.substring(2);
              if (numberString.contains("s")) {
                  int indexOfS = numberString.indexOf('s');

                  String mantissaHexString = numberString.substring(0, indexOfS);
                  String exponentHexString = numberString.substring(indexOfS + 1);
                  
                  BigInteger mantissa = new BigInteger(mantissaHexString, 16);
                  BigInteger exponent = new BigInteger(exponentHexString, 16);

                  return new BigDecimal(mantissa).scaleByPowerOfTen(exponent.negate().intValueExact());
              }
              return new BigDecimal(new BigInteger(numberString, 16));
          } else {
              return new BigDecimal(numberString);
          }
      } else {
          return BigDecimal.ZERO;
      }
  }
}

