LogiQuest

338. Library Fine

EasyConditionalsDates

A book returned after its due date is fined: ₹15 per late day if returned in the same month and year; ₹500 per late month if in the same year; a flat ₹10000 if in a later year. Print the fine (0 if returned on time).

Input format

Line 1: returned d m y Line 2: due d m y

Output format

The fine.

Example 1

Input

9 6 2015
6 6 2015

Output

45

Example 2

Input

1 1 2016
31 12 2015

Output

10000

Constraints

Valid dates.

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…