adding solution to first problem