ms r1b 2014 http://hihocoder.com/contest/msbop2014r2b/problem/2