Area#727

Area

1 second
256 megabytes
Easy

For the given function

F(x) = a_0 \cdot f_0(b_0 \cdot x) + \ldots + a_n \cdot f_n(b_n \cdot x)

and given values and , determine the area enclosed by the graphs of the functions y = F(x), y = -C, x = A, and x = B. Here,

0 \le n \le 25, \qquad -25 \le a_i, b_i \le 25, \qquad b_i \ne 0,
C = |a_0 / b_0| + \ldots + |a_n / b_n|, \qquad -1000 \le A, B \le 1000,

and each f_i is either or .

Input

The input file starts with the numbers and , followed by a single line containing without spaces. In this line, a_i and b_i may be omitted, in which case their values are considered . Similarly, should be interpreted as -1 \cdot \sin(-1 \cdot x).

Output

The output file should contain a single line with the required area, represented with a precision of 6 decimal places.

Examples

Example 1

Loading
Loading