BRHQUADR - Quadratics

no tags 

Butch needs help with checking his math homework. He is studying quadratic equations, which are in the form

y = ax2+bx+c

He wants to give you a, b, c, and x (1 ≤ a, b, c, x ≤ 10), and asks you to find y.

Input

Line 1: Three space-separated integers, a, b, and c.
Line 2: A single integer, x.

Output

Line 1: A single integer, y

Example

Input:
2 5 3
-4

Output: 15

hide comments
circleous: 2017-06-04 07:25:05

The constraints are wrong, 1 <= x <= 10. But its written in example x is -4.

Vaibhav Yenamandra: 2013-08-11 03:57:36

This can easily be moved to tutorial

Bharath Reddy: 2011-12-20 18:09:41

Hey, no points even if we score 100 points in this problem?


Added by:Damon Doucet
Date:2009-11-02
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 NODEJS OBJC PERL6 SQLITE VB.NET