#C8432. Calculate Traffic Light Cycle

    ID: 52414 Type: Default 1000ms 256MiB

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:

t+3+t+3t + 3 + t + 3

The total cycle time for the intersection is computed by multiplying the per-direction cycle by 4 (for the four directions):

4×(t+3+t+3)4 \times (t + 3 + t + 3)

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:

4×(t+3+t+3)4 \times (t + 3 + t + 3)

sample

30
276