Rosetta Problems

Joseph's Potato

https://onlinejudge.u-aizu.ac.jp/problems/0085