The Multiply, Screen, and Overlay blend modes in image manipulation programs such as Photoshop are very useful when making digital art. If you apply one of these modes to a base colour and a top colour, a resulting colour is produced. Colours have three components: , , and , which can have any real value from to (completely dark to completely light) inclusive, and modes operate on each component separately. Let's call a component of the base colour and the same component of the top colour .
If you apply the Multiply mode, the resulting component will be . As this produces a darker colour, it is good for drawing shadows.
If you apply the Screen mode, the resulting component will be . As this produces a lighter colour, it is good for drawing highlights.
The Overlay mode produces different results depending on the base component. If this component is less than , the resulting value is . Otherwise, the resulting value is . As this makes dark colours darker and light colours lighter, it is good for adding contrast.
Given a blend mode and each component of the base and top colours, please find the resulting colour.
Input Specification
The first line will contain one of the following strings: Multiply
, Screen
, or Overlay
, the blend mode.
The second line will contain 3 space-separated real numbers: , , and representing each component of the base colour.
The third and final line will contain 3 space-separated real numbers: , , and representing each component of the top colour.
Output Specification
Output 3 space-separated real numbers on one line: the , , and of the resulting colour.
Your answer will be judged correct if it has an absolute or relative error less than or equal to .
Sample Input
Multiply
0.30 0.22 0.90
0.52 0.12 0.03
Sample Output
0.156000 0.026400 0.027000
Comments