Game of Moves
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 100M1
,M2
andM3
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