Fixed level of abstraction in solution 4
added exception for n=1