package pl.codegym.task.task04.task0442;


/*
Dodawanie
*/

import java.io.*;

public class Solution {
    public static void main(String[] args) throws Exception {

        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));

        int suma = 0;
        int liczba;

        for (; true;){

            liczba = Integer.parseInt(reader.readLine());
            suma += liczba;

            if (liczba != -1){
                System.out.println(suma - 1);
                break;
            }

        }
    }
}
HI. The strange thing [(for me, surely not for you :)] is that that code takes into count only the first number and last -1 from all of them inputed. It doesn't take into account all the numbers in_between. If I input: 5, 6, 5, ..., -1 my result is 4. It doesnt sum up all numbers. Please help :)