Average in Bash

Problem

Given N integers, Show the average of N integers with 3 decimal places.

Input Format
La primera linea contiene The first line contain N integers.N lines with only one number.

Output Fromat
The integer with 3 decimal places.

Example


Input

4
1
2
9
8

Output

5.000


Code

read a
b=0
for (( c=1; c<=$a; c++ ))
do
read d
b=$(($b+$d))
done
echo $(printf %.3f $(echo "scale=4;($b/$a)" | bc))

No comments: