#151. 遇13停止求和

    ID: 151 Type: Default 1000ms 256MiB Tried: 0 Accepted: 0 Difficulty: (None) Uploaded By: Tags>codingbatLogic-2gesp1条件结构数学基础

遇13停止求和

Sum with 13 Skip

Background

Congcong is playing a number game. He finds that the number 1313 always seems to bring bad luck, so he decides that when calculating a sum, if he encounters 1313, he will skip it and all subsequent numbers to its right.

Problem Description

Given three integer values, a,b,ca, b, c, return their sum. However, if one of the values is 1313, then it does not count towards the sum and values to its right do not count. So for example, if bb is 1313, then both bb and cc do not count.

Input Format

Input is given from Standard Input in the following format.

aa bb cc

Output Format

Output is printed to Standard Output in the following format.

Their sum

Sample

1 2 3
6
1 2 13
3
1 13 3
1

Sample Explanation

Sample 1: a=1,b=2,c=3a=1, b=2, c=3. No number is 1313, so the sum is 1+2+3=61+2+3=6.

Sample 2: a=1,b=2,c=13a=1, b=2, c=13. cc is 1313, so cc does not count towards the sum. The sum is 1+2=31+2=3.

Sample 3: a=1,b=13,c=3a=1, b=13, c=3. bb is 1313, so both bb and cc do not count towards the sum. The sum is 11.

Constraints

Time limit: 1 second, Memory limit: 1024KB.