simplified solution to 49