ABC 156 E - Roaming
https://atcoder.jp/contests/abc156/tasks/abc156_e