[SRM603] MiddleCode by Yanzhe Chen