SRM 571 and Codeforces 170 prob E are added