Under construction

Still being built. Things may change

Haru Dermatology

Time limit1sMemory limit1024 MB

Summary
Given a quadratic f(x) and a line g(x), compute the integral of f(x) minus g(x) from x1 to x2, which is an integer.
Level

Easy2 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

In 2023, Haru opened a dermatology clinic and treats acne with HARU-LASER, a laser made for acne.

The shape of an acne spot is given by the quadratic f(x)=ax2+bx+cf(x) = ax^2+bx+c. The laser is set to the linear function g(x)=dx+eg(x) = dx+e, and its intensity is defined as ∫x1x2{f(x)−g(x)} dx\int_{x_1}^{x_2} \{f(x) - g(x)\}\,\mathrm{d}x.

Here x1x_1 and x2x_2 are the x-coordinates of the two ends of the acne. The domains of f(x)f(x) and g(x)g(x) are (−∞,∞)(-\infty, \infty).

Haru opened the clinic not long ago and still struggles to calculate the laser intensity. Calculate it for Haru.

Input

The first line contains x1x_1 and x2x_2 separated by a space.

The second line contains the coefficients aa, bb, cc, dd, and ee separated by spaces.

All input numbers are integers. The input is guaranteed to give a laser intensity that is an integer with absolute value at most 10910^{9}.

Output

Print the laser intensity on the first line.

Constraints

  • −30≤x1<x2≤30-30 \leq x_1 < x_2 \leq 30
  • −30≤a,b,c,d,e≤30-30 \leq a,b,c,d,e \leq 30
  • a,d≠0a,d \neq 0
  • aa is a multiple of 33
  • bb and dd are multiples of 22

Examples2

  1. Example 1

    Input
    0 1
    3 4 2 8 3
    
    Expected output
    -2
    
  2. Example 2

    Input
    -3 3
    -15 -4 5 -2 -5
    
    Expected output
    -210