2012 summer practice contest 5

D: easy