Term index in an arithmetic sequence

Given a first term, a common difference, and a value k, print the 1-based position of k in the arithmetic sequence, or X if k is absent.

Easy2MathImplementationNo attempts yetTime limit2sMemory limit512 MB

Problem

An arithmetic sequence is a sequence in which the difference between two neighboring terms is always the same. That fixed difference is called the common difference.

  • 1, 3, 5, 7, 9, ...
  • 2, 4, 6, 8, 10, ...
  • 1, 5, 9, 13, 17, ...
  • -1, -3, -5, -7, -9, ...

The sequence with first term aa and common difference dd runs aa, a+da+d, a+2da+2d, a+3da+3d, so its nn-th term is a+(n1)da+(n-1)d.

Write a program that finds which term of that sequence the number kk is.

Input

The first line contains three integers aa, dd, kk separated by spaces.

  • The first number is the first term aa, with 1000<a<1000-1000 < a < 1000.
  • The second number is the common difference dd, with 1000<d<1000-1000 < d < 1000 and d0d \neq 0.
  • The third number is the value kk you are looking for, with 1000000<k<1000000-1000000 < k < 1000000.

Output

Print one integer, the position of kk in the sequence. The first term counts as position 1.

If kk does not occur in the sequence, print X.