#C12924. Calculate Student's Valid Average Grade

    ID: 42405 Type: Default 1000ms 256MiB

Calculate Student's Valid Average Grade

Calculate Student's Valid Average Grade

You are given a list of courses with their corresponding grades. Your task is to compute the average grade considering only the valid grades. A grade is considered valid if it lies within the range \(0 \leq grade \leq 100\). If no valid grade exists, output None.

Details:

  • If the number of courses is zero or if all grades are anomalous (i.e. not in the interval \([0, 100]\)), output None.
  • If there is at least one valid grade, calculate the average by summing these valid grades and dividing by their count. If the average is an integer, output the integer value; otherwise, output the average rounded to 6 decimal places.

Input will be provided via standard input (stdin) and output must be printed to standard output (stdout).

inputFormat

The first line contains an integer \(n\) representing the number of courses. Each of the following \(n\) lines contains a course name (a string without spaces) and a grade (a number), separated by whitespace.

For example:

3
Math 90
Science 80
History 85

outputFormat

If there is at least one valid grade (i.e. grade in \([0, 100]\)), print the average grade. Print an integer if the result is a whole number; otherwise, print the average rounded to 6 decimal places.

If there are no valid grades, print None.

## sample
0
None