#P5082. Comprehensive Exam Score Evaluation

    ID: 18320 Type: Default 1000ms 256MiB

Comprehensive Exam Score Evaluation

Comprehensive Exam Score Evaluation

After finishing his final exams, Xiao Ben is awaiting his results. The teacher has devised a scheme to compute a comprehensive exam score based on the scores of individual subjects. You are given the full marks and the actual scores for each subject. The comprehensive score is defined using the formula below:

\[ \text{Score} = \frac{3\sum_{i=1}^{n}F_i - 2\sum_{i=1}^{n}A_i}{\sum_{i=1}^{n}(F_i-A_i)} \]

Here, \(F_i\) is the full marks for subject \(i\) and \(A_i\) is the actual score obtained in that subject.

Your task is to compute and output the comprehensive exam score.

inputFormat

The input consists of three lines:

  • The first line contains an integer \(n\) denoting the number of subjects.
  • The second line contains \(n\) space-separated integers representing the full marks for each subject.
  • The third line contains \(n\) space-separated integers representing the actual scores obtained in each subject.

outputFormat

Output a single floating-point number representing the comprehensive exam score.

sample

3
100 120 150
99 73 100
5.775510204081632