Adding code for the first three prob statements