13154 - Bee cover rain   

Description

Rainbow buy paper. A large time of banana onto go apple rolling line. So we but feel soon as we you old. Hence, bad bed back baseball. Us US across three turtles island wall: handing-voices wulabo distance. Yellow yark yield yo yo so so do. Ears along wind lose french choice. Cost always elephant joy how flower deeper, rest hair and out.


Anyway, you are given two integers  and . Let's define .

Now you need to calculate the result of an expression which contains only  functions and some integers.

For convenience you only need to output the remainder of the result divided by  (i.e. the result ).

Recall the remainder  of  divided by  is a non-negative integer such that  for some integer  and .

Sample Explanation

In Sample:  = 2 and  = 5. The expression is .

And the remainder of 9 divided by  is equal to 4. So the output is 4.

Hint

In mathematics, there are two properties about modulo operation(suppose  are integers and ):

That is if you want to modulo the result of some expression which consists of only addition or/and multiplication, you could just modulo any part in the expression as long as remembering to modulo the final result.

Input

The first line contains two integers  and  (). 

The second line contains a string  () – the expression you need to calculate. The expression must consists of only  function(at least one  function) and integers ( all the integers ). Every character in the string must be f or ( or ) or , or digits and the expression must be legal.

 

It's guaranteed that:

  • The 1st testcase must be identical to the Sample below
  • For the first seven testcases:

Output

Output the remainder of the result of the expression divided by  then print a newline('\n') character.

Sample Input  Download

Sample Output  Download

Tags




Discuss