public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double result = 0.0f;
int sum = 0;
int i = 0;
while(true)
{
String numbers = br.readLine();
int num = Integer.parseInt(numbers);
if(num == -1)
{
break;
}
if(num != 0)
{
sum += num;
i++;
}
}
if(sum == 0)
{
result = 0.0;
}
else
{
result = (double)sum/(double)i;
}
System.out.print(result);
}
}

package com.codegym.task.task05.task0507;
import java.io.*;
/*
Arithmetic mean
*/
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
double result = 0.0f;
int sum = 0;
int i = 0;
while(true)
{
String numbers = br.readLine();
int num = Integer.parseInt(numbers);
if(num == -1)
{
break;
}
if(num != 0)
{
sum += num;
i++;
}
}
if(sum == 0)
{
result = 0.0;
}
else
{
result = (double)sum/(double)i;
}
System.out.print(result);
}
}