fork download
  1.  
  2. import java.util.*;
  3. import java.lang.*;
  4. import java.io.*;
  5.  
  6. class A278 {
  7. public static void main (String[] args) throws java.lang.Exception {
  8. Scanner scanner = new Scanner(System.in);
  9. double numerator = 0;
  10. int denominator = 0;
  11. while (scanner.hasNext()) {
  12. int n = scanner.nextInt();
  13. double x = scanner.nextDouble();
  14. numerator += n*x;
  15. denominator += n;
  16. }
  17. double result = numerator / denominator;
  18. System.out.println(result);
  19. }
  20. }
Success #stdin #stdout 0.15s 322368KB
stdin
1 2 3 4 5 0.6
stdout
1.8888888888888888