P27442 [AtCoder] Time Difference
普及
题目描述

Problem Description

Score: $ 100 $ points

PAKEN learned about "time difference" in his geography class.

On Earth, there is a time difference of 1 hour for every 15 degrees of longitude.

Given a character representing whether the longitude is east or west $ C1, C2 $ (west longitude is W, east longitude is E) and the longitudes $ A, B $ (corresponding to $ C1, C2 $ respectively) over two lines, calculate the time difference between the two locations.

However, the International Date Line is assumed to be at 180 degrees east longitude, and the time difference should be calculated without crossing the International Date Line. For example, the time difference between 120 degrees east longitude (E 120) and 90 degrees east longitude (E 90) is 2 hours. Also, the time difference between 165 degrees west longitude (W 165) and 165 degrees east longitude (E 165) is 22 hours.

Input Format

The input is given from the standard input in the following format:

$ C1 $ $ A $ $ C2 $ $ B $

Output Format

Output the time difference between the two locations.

Sample Input and Output

Sample Input #1

E 120
E 90

Sample Output #1

2

Sample Input #2

W 165
E 165

Sample Output #2

22

Notes/Hints

Constraints

  • $ C1, C2 $ are either W or E.
  • $ A, B $ are multiples of 15 and range from 0 to less than 180.

Subtasks

There are no subtasks or partial points for this problem.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
E 120 E 90
样例输出
2