32 lines
588 B
Java
32 lines
588 B
Java
package chelper;
|
|
|
|
import io.InputReader;
|
|
import io.OutputWriter;
|
|
import misc.SimpleSavingChelperSolution;
|
|
|
|
|
|
public class M extends SimpleSavingChelperSolution {
|
|
|
|
public void solve(int testNumber, InputReader in, OutputWriter out) {
|
|
wrapSolve(testNumber, in, out);
|
|
}
|
|
|
|
@Override
|
|
public void solve(int testNumber) {
|
|
int n = in.nextInt();
|
|
|
|
int[] a = in.nextIntArray(n);
|
|
|
|
boolean ok = true;
|
|
int d = a[1] - a[0];
|
|
|
|
for (int i = 0; i < n - 1; i++) {
|
|
int t = a[i + 1] - a[i];
|
|
|
|
ok &= t == d;
|
|
}
|
|
|
|
out.println(ok ? (a[n - 1] + d) : a[n - 1]);
|
|
}
|
|
}
|