Solved P30 and P31.