Rosetta Problems

Taking the middle

https://atcoder.jp/contests/agc053/tasks/agc053_b