Problem A&B
2008 problem A