Advanced arithmetic

Some of the more complex formulas require some operations to be performed first, and others afterward. In math, we prioritize them with parentheses.
In this formula, a + b - c needs to be performed before the multiplication, and the subtraction of 2 needs to happen in the end.
In math, the top priority is given to parentheses, then exponentiation, then multiplication or division, then addition or subtraction.
Python follows the same priority order. The order of priorities for arithmetic operations is:
  1. Parentheses
  1. Exponentiation
  1. Multiplication and division
  1. Addition and subtraction
 
Knowing this, your task is to calculate a complex formula, given a and b integers as an input:
Print the value of y in the output.
Input
Output
3 4
16
 

Constraints

Time limit: 2 seconds

Memory limit: 512 MB

Output limit: 1 MB

To check your solution you need to sign in
Sign in to continue