Rosetta Problems

One Three Nine

https://atcoder.jp/contests/arc139/tasks/arc139_c