Given two integers ‘n1’ and ‘n2’, select two integers ‘a’ and ‘b’, such as to solve the equation (n1 * a + n2 * b = x). But there is a catch, ‘x’ is the smallest positive integer which satisfies the equation.

-10^7 <= a, b <= 10^7

0 <= n1, n2 <= 10^7

how it can be solved

i assume that it is a gcd problem like gcd(n1,n2)=x so it give correct answer for all test cases?