#K72232. Traffic Light Schedule

    ID: 33708 Type: Default 1000ms 256MiB

Traffic Light Schedule

Traffic Light Schedule

You are given a traffic light schedule for a day represented as a string S of length 1440, where each character corresponds to the light state at a particular minute past midnight. Each character of S is one of the following:

  • G: Green
  • Y: Yellow
  • R: Red

You are also given an integer t (with \(0 \le t \le 1439\)) representing the time in minutes past midnight. Your task is to output the traffic light state at time t, i.e. the character at index t (0-indexed) of the schedule string.

Note: The schedule string always has exactly 1440 characters.

inputFormat

The input is read from standard input and consists of two lines:

  1. The first line is a string S of length 1440 representing the traffic light schedule.
  2. The second line is an integer t (\(0 \le t \le 1439\)) indicating the time in minutes past midnight.

outputFormat

Output a single character (G, Y, or R) to standard output, representing the traffic light state at the given time.

## sample
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
10
G