Traffic Lights
Bob is a renowned scientist who lives near his workplace, so he often walks to work. On his route, he encounters a traffic light with three colored bulbs: red, yellow, and green.
The traffic light operates according to the following sequence:
The green light is on for g seconds.
The green light blinks for gb seconds, during which it is on for exactly half the time.
The yellow light is on for y seconds.
The red light is on for r seconds.
Both the red and yellow lights are on simultaneously for ry seconds.
After completing the fifth step, the sequence repeats starting from the first step. Transitions between these modes occur instantly.
Bob wants to calculate how long each bulb stays lit during a day that lasts T seconds. He assumes that at the start of the day, the green light is on. During the blinking phase of the green light, it is assumed that the bulb is on for exactly half the time from the start to any given moment.
Input
The first line of the input contains five integers: g, gb, y, r, ry (1 ≤ g, gb, y, r, ry ≤ 100), with gb being even.
The second line contains an integer T (1 ≤ T ≤ 10000), which represents the duration of the day in seconds.
Output
Output three integers representing the total time the red, yellow, and green bulbs are on during the day, respectively.