시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB34201450.000%

문제

There is a trapezoid with vertices $(x_1, y_1)$, $(x_1, y_2)$, $(x_2, y_3)$, $(x_2, y_4)$ in the Euclidean plane that is painted with a linear gradient (defined below).

Let a triple of real numbers $(r, g, b)$ represent a color of a point, and let us use this to define three colors:

  • red: $r \geq 150$, $g \leq 75$, $b \leq 75$;
  • green: $g \geq 150$, $r \leq 75$, $b \leq 75$;
  • blue: $b \geq 150$, $r \leq 75$, $g \leq 75$.

The trapezoid is colored using a set of lines which collectively cover the entire area of the trapezoid and produce a color gradient. The set is defined as follows:

  • Each line in the set is defined by a value of $t$ ($t \in [0, 1]$).
  • The endpoints of the line are $(x_1, (1 - t) y_1 + t y_2)$ and $(x_2, (1 - t) y_3 + t y_4)$.
  • The color of the left endpoint is ($r_{\ell}, g_{\ell}, b_{\ell}$), and the color of the right endpoint is ($r_r, g_r, b_r$).
  • The color of an inner point on the line is determined by linear interpolation (see Note for definition) between the left and right colors, based on the distance from the left endpoint to that point.

Calculate the total area of the red, blue, and green parts of the trapezoid.

입력

The first line contains integers $x_1$, $y_1$, $y_2$, $r_{\ell}$, $g_{\ell}$, $b_{\ell}$.

The second line contains integers $x_2$, $y_3$, $y_4$, $r_r$, $g_r$, $b_r$.

출력

Output three real numbers: the red area, the blue area, and the green area, respectively. The absolute or relative error should not exceed $10^{-9}$.

제한

  • $0 \leq x_1 < x_2 \leq 100\,000$;
  • $0 \leq y_1 < y_2 \leq 100\,000$;
  • $0 \leq y_3 < y_4 \leq 100\,000$;
  • $0 \leq r_{\ell}, g_{\ell}, b_{\ell}, r_r, g_r, b_r \leq 255$.

예제 입력 1

0 0 50 255 0 0
100 0 100 0 255 0

예제 출력 1

1686.851211072
2724.913494800
0.000000000

노트

Linear interpolation is a method of estimating values within an interval, based on known values at the endpoints. In the context of color interpolation, it means that the color components $(r, g, b)$ are calculated as a weighted average of the corresponding components of the left and right colors, with the weights determined by the relative distance of the point from the left endpoint and the right endpoint. This creates a smooth transition of colors along the line.