Codeforces Round #187 Problem ABCD