Polynomial Derivative (Small)

Given the nonzero terms of a polynomial, compute the value of its derivative at x = 1.

Easy1MathImplementationBrute forceInterviewNo attempts yetTime limit1sMemory limit128 MB

Problem

Seongmin is taking calculus this semester. While working through the homework on differentiating polynomials, he got tired of doing it by hand, so he decided to write a program that takes a function f(x)f(x) and returns its derivative f(x)f'(x) for him.

You are given the coefficient and the degree of every term of a polynomial f(x)f(x). Compute f(1)f'(1).

Input

The first line contains the number of terms N (1 ≤ N ≤ 100).

Each of the next N lines contains the coefficient C (-100 ≤ C ≤ 100, C ≠ 0) and the degree K (0 ≤ K ≤ 1000) of one term, separated by a space. The terms are given in decreasing order of degree, and no degree appears more than once.

Output

Print the value of f(1)f'(1) on the first line.

Hint

Differentiating f(x)=3x3+2x2+xf(x) = 3x^3 + 2x^2 + x gives f(x)=9x2+4x+1f'(x) = 9x^2 + 4x + 1.

So f(1)=9+4+1=14f'(1) = 9 + 4 + 1 = 14.