Comments
On LewinWunder Fund Round 2016, 8 years ago
+3

n cannot be 1. (2 ≤ n ≤ 200 000, 1 ≤ x, y ≤ 109)

This problem comes from 2015 Multi-University Training Contest 10. And you can find the solution here.