Under construction

Still being built. Things may change

Scientific Grading

Time limit1sMemory limit1024 MB

Summary
Given x and y in scientific notation, check whether four student answers to x+y, x-y, x*y, and x/y are within 1e-9 error of the true results.
Level

Medium6 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

You recently started working as a TA (teaching assistant) for your university's Scientific Computing class.

Today, Professor introduced the scientific notation, where numbers are written in the form m×10nm \times 10^n with a real number mm (the significand) and an integer nn (the exponent).

At the end of class, she gave students the following assignment.

Given two numbers xx, yy in scientific notation, perform the following four arithmetic operations:

  • x+yx + y
  • x−yx - y
  • x×yx \times y
  • x/yx / y

As a strict grader, you decided to write a program to grade students' answers.

You mark a solution correct if and only if both relative and absolute errors are less than 10−910^{-9} (not including 10−910^{-9}).

If the correct answer is 00, then 00 is the only acceptable answer.

Otherwise, a student's answer zz will be compared to the correct answer z~\tilde{z}, and the relative and absolute errors are computed as ∣z−z~∣∣z~∣\frac{|z - \tilde{z}|}{|\tilde{z}|} and ∣z−z~∣|z - \tilde{z}|, respectively.

Input

The first line of input contains the value of xx, and the second line contains the value of yy.

The next four lines contain a student's answer to x+yx+y, x−yx-y, x×yx \times y, and x/yx/y.

All numbers are in the form of <SIGNIFICAND>e<EXPONENT>. The significand mm starts with a sign (+ or -), followed by one digit, a period (.), and exactly nine digits.

The exponent nn also starts with a sign (+ or -) and is followed by an integer between 00 and 10910^9, inclusively.

The value is computed by m×10nm \times 10^n.

The value 00 is always represented as +0.000000000e+0, and for any nonzero values the first digit of their significand is not 00.

It is guaranteed that xx and yy are both nonzero.

Output

For each student solution, output Correct if it is considered correct and Incorrect otherwise. The first line of output indicates if the student's solution to x+yx+y is correct, the second line indicates if their solution to x−yx-y is correct, the third line indicates if their solution to x×yx \times y is correct, and the fourth line indicates if their solution to x/yx/y is correct.

Examples2

  1. Example 1

    Input
    +2.000000000e+1
    +3.000000000e+2
    +3.200000000e+2
    -2.800000000e+2
    +6.000000000e+3
    +6.666666667e-2
    
    Expected output
    Correct
    Correct
    Correct
    Correct
    
  2. Example 2

    Input
    +1.000000000e-1
    +1.000000000e-1
    +2.000000003e-1
    +1.000000000e-18
    +1.000000002e-2
    +1.000000001e+0
    
    Expected output
    Incorrect
    Incorrect
    Incorrect
    Incorrect