Solved (but didn't optimized) and sent Problem 35 to repository.