The term color gradient is used to identify a sequence of colors that are dependent on their position. A linear color gradient is characterized by two points that each have a different color. The points in between those two points are calculated using linear interpolation. Below, for example, you will find the color gradient between a red point (on the left side) and a green point (on the right side).
R:255 G:0 B:0 |
R:238 G:17 B:0 |
R:221 G:34 B:0 |
R:204 G:51 B:0 |
R:187 G:68 B:0 |
R:170 G:85 B:0 |
R:153 G:102 B:0 |
R:136 G:119 B:0 |
R:119 G:136 B:0 |
R:102 G:153 B:0 |
R:85 G:170 B:0 |
R:68 G:187 B:0 |
R:51 G:204 B:0 |
R:34 G:221 B:0 |
R:17 G:238 B:0 |
R:0 G:255 B:0 |
A color's RGB value consists of three natural numbers between 0 and 255 (borders included), that respectively indicate the red, green and blue component of that color. If the RGB values $$(r_0, g_0, b_0)$$ and $$(r_1, g_1, b_1)$$ of colors are given at two points, $$n$$ color transition can be calculated as folows. The $$i$$-de ($$0 \leq i < n$$) color component $$c_i$$ is given by \[ c_i = c_0 + \frac{i}{n - 1}(c_1 - c_0) \] This applies to all red ($$c = r$$), green($$c = g$$) and blue($$c = b$$) color components. The value of a color component is always rounded off to the nearest natural number. The picture above, for example, shows 16 color transitions between red $$(255, 0, 0)$$ and green $$(0, 255, 0)$$. Pay attention to the fact that if the three color components of an RGB value are equal, the color indicates a grey scale. The 12 color transitions between black $$(0, 0, 0)$$ and white $$(255, 255, 255)$$, for example, have the following result
R:0 G:0 B:0 |
R:23 G:23 B:23 |
R:46 G:46 B:46 |
R:70 G:70 B:70 |
R:93 G:93 B:93 |
R:116 G:116 B:116 |
R:139 G:139 B:139 |
R:162 G:162 B:162 |
R:185 G:185 B:185 |
R:209 G:209 B:209 |
R:232 G:232 B:232 |
R:255 G:255 B:255 |
The first line contains a number $$n \in \mathbb{N}_0$$. After that, six integers between 0 and 255 (borders included) follow, indicating the RGB values of two points.
Print the $$n$$ color transitions of the color gradient between two points given. The RGB value of every transition should be printed on a separate line in the format rgb(red, green, blue), fragment in italics must be filled out with the values of the color components. The value of each component is always rounded off to the nearest integer.
Input:
16
255
0
0
0
255
0
Output:
rgb(255, 0, 0)
rgb(238, 17, 0)
rgb(221, 34, 0)
rgb(204, 51, 0)
rgb(187, 68, 0)
rgb(170, 85, 0)
rgb(153, 102, 0)
rgb(136, 119, 0)
rgb(119, 136, 0)
rgb(102, 153, 0)
rgb(85, 170, 0)
rgb(68, 187, 0)
rgb(51, 204, 0)
rgb(34, 221, 0)
rgb(17, 238, 0)
rgb(0, 255, 0)