when i try to input this integer i get an error -10 20 -40 << error the output should be 80
{
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String[] input = new String[n];
for (String input1 : input) {
input = in.readLine().split(" ");
int x = Integer.parseInt(input[0]);
int y = Integer.parseInt(input[1]);
int z = Integer.parseInt(input[2]);
if (y - x == z - y)
{
System.out.println(z+ y - x);
}
else
{ //-10 20 -40
System.out.println(z / (x / y));
}