[SRM613] Solve Problem IIE, M, IE.