#P5323. Light Transmission in Layered Glass
Light Transmission in Layered Glass
Light Transmission in Layered Glass
When a beam of light strikes a layer of glass, a certain percentage of the light passes through, a certain percentage is reflected back, and the remaining light is absorbed by the glass. For any amount of light ( x ), the light that passes through is ( x \times a_i% ) and the light that is reflected is ( x \times b_i% ). Given ( n ) layers of glass stacked one on top of the other, and starting with 1 unit of light on the first layer, calculate the amount of light that passes through all ( n ) layers. Note that for each layer, the values of ( a_i ) and ( b_i ) are provided, and it is guaranteed that ( a_i + b_i \leq 100 ) for every layer.
inputFormat
The input consists of multiple lines. The first line contains an integer ( n ) (the number of glass layers). This is followed by ( n ) lines, each containing two floating-point numbers ( a_i ) and ( b_i ) representing the percentage of light that passes through and the percentage of light that is reflected by the ( i^{th} ) layer respectively.
outputFormat
Output a single floating-point number representing the total units of light that pass through all ( n ) layers. The answer should be computed as the product of ( \frac{a_i}{100} ) for all layers, starting with an initial light intensity of 1 unit.
sample
1
80.0 10.0
0.8
</p>