Game of Moves


Submit solution

Points: 100
Time limit: 5.0s
Memory limit: 256M

Author:
Problem type

Problem Statement

Rahaf wants to create a game using programming.
The game starts with a position P.
The player then can make three moves: M1, M2 and M3. These moves can be one of two, forward + or backward -.

For example, if you start with position 5, and use the moves + + -, then you will end up in position 6.


Constraints

  • N is an integer between 10 and 100
  • M1, M2 and M3 are strings that can be either + or -

Input

Input is in the following format:

N
M1
M2
M3

All inputs to be captured first then processed.


Output

Print the final position as an integer


Samples

Sample 1

Input Output
10
+
+
+
13

Sample 2

Input Output
10
-
-
-
7

Sample 3

Input Output
20
+
-
-
19

Comments

There are no comments at the moment.