Update Problem 1 Solution

Generalized the problem and allow for user input