Codeforces Round #470 E Perpetual Subtraction

NoSuchKey