Problem Idea #9

Suresh is playing a game with N levels. He passes level i with probability pi and the time taken for level i is ti (regardless of whether he passes the level or not). Whenever Suresh fails any level, he has to start again from the first level. Find the expected time when Suresh will be able to pass all the levels.

1 ≤ T ≤ 10

1 ≤ N ≤ 10000

1 ≤ ti ≤ 10000

0 ≤ pi ≤ 1