Is that possible to write a code for this problem?

There is a game in n steps. The probability of gaining in step j is “xj/100” (1<= xj <= 100). The game begins from step 1 on day 1 as follows:

  • If you gain in step j and you gain you stop the game and begin step j+1 the next day.
  • If you are in step j and you fail you stop the game and begin the game from step 1 the next day.

The question is: What is the expectation of number of days that it will take to complete this game?

Input include two consecutive lines: First line : n

      Second line:  n numbers showing xi

Output is just a number that is expectation of days it needs to solve this game

As an example: Input: 3

                  10 20 50

Output: 112