/* * 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 sutaz; import java.util.Scanner; /** * |||| * @author janotka1 */ public class Bill { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int line = 0; int sum = 0; String next = ""; boolean nextLine = true; String lin = sc.nextLine(); while (sc.hasNext()) { String number = ""; if(lin.charAt(0) != '|') { int index = 0; char c = lin.charAt(index); while(c != ',') { number += c; index++; c = lin.charAt(index); } int count = (lin.length() - (index +2)); if(count == 0) sum += Integer.parseInt(number); else { sum += Integer.parseInt(number) * (lin.length() - (index +2));} } else { sum+= lin.length() * 42; } lin = sc.nextLine(); } int hov = sum % 10; if(hov != 0) { sum += 10 - hov; } System.out.println(sum + ",-"); } }