/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package bill; import java.util.Scanner; /** * * @author boban3 */ public class Bill { public static void main(String[] args) { Scanner skener = new Scanner(System.in); long suma = 0; while (skener.hasNextLine()) { String slovo = skener.nextLine(); int pocet = 0; if (slovo.charAt(0) =='|') { pocet = slovo.length(); suma += pocet * 42; } else { String[] pom = slovo.split(",-"); int cislo = Integer.parseInt(pom[0]); if (pom.length > 1) pocet = pom[1].length(); suma += pocet * cislo; } } System.out.println(Math.round(suma / 10.0) * 10 + ",-"); } }