OTHS Coding Competition 1 (Mock CCC) J1 - Math Assistance

View as PDF

Points: 3
Time limit: 1.0s
Memory limit: 512M

Author:
Problem type

Two enemies confront Gojo Satoru, possessing cursed energy levels denoted as and respectively. Gojo wants to know the combined cursed energy of the two enemies. The combined cursed energy is usually the sum, but there is a peculiar exception: if either of the enemies has a cursed energy level of 0, the energy level of the other one becomes 0 as well. Since Gojo missed his math classes to learn magic, he seeks your help, a math student, to assist him.

Input Specification

The first line contains a non-negative integer the cursed energy of the first enemy. The second line contains another non-negative integer the cursed energy of the second enemy.

Output Specification

Output one non-negative integer as specified above.

Sample Input 1

0
45

Sample Output 1

0

Explanation for Sample Output 1

One of the two numbers is 0 so the answer is 0.

Sample Input 2

999
999

Sample Output 2

1998

Explanation for Sample Output 2

Neither numbers are 0 so the sum is outputted.