https://atcoder.jp/contests/joi2014ho/tasks/joi2014ho5