#C8432. Calculate Traffic Light Cycle
Calculate Traffic Light Cycle
Calculate Traffic Light Cycle
A four-way intersection operates with a systematic traffic light cycle. For each of the four directions (North, South, East, and West), the cycle consists of two phases for both straight-moving and left-turning traffic:
- A green light phase lasting t seconds (where t is the provided input) for allowing movement.
- A yellow light phase lasting 3 seconds immediately after the green light.
Each direction has two such phases (one for straight movement and one for left turn), resulting in a cycle duration for one direction of:
The total cycle time for the intersection is computed by multiplying the per-direction cycle by 4 (for the four directions):
Your task is to read the integer t
representing the green light duration (in seconds) and output the total cycle time in seconds.
inputFormat
The input consists of a single line containing an integer t
, the duration of the green light (in seconds) for both straight and left-turning traffic.
outputFormat
Output a single integer representing the total cycle time for the four-way intersection, computed as:
sample
30
276