import core.bitop;
import std.algorithm;
import std.array;
import std.ascii;
import std.container;
import std.conv;
import std.format;
import std.math;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

int n;
int[] a;
int[][][] memo;
bool[][] done;
int[] dfs(int turn, int index, int z, int w)
{
  if (index == n) {
    return [z, w];
  }
  if (done[turn][index])
  {
    return memo[turn][index];
  }
  int ans = turn == 0 ? int.min : int.max;
  int[] ret;
  for (int i = index; i < n; ++i)
  {
    if (turn == 0) {
      auto sub = dfs(1, i + 1, a[i], w);
      if (ans < abs(sub.front - sub.back)) {
        ans = abs(sub.front - sub.back);
        ret = sub;
      }
    } else {
      auto sub = dfs(0, i + 1, z, a[i]);
      if (ans > abs(sub.front - sub.back)) {
        ans = abs(sub.front - sub.back);
        ret = sub;
      }
    }
  }
  done[turn][index] = true;
  memo[turn][index] = ret;
  return ret;
}

void main()
{
  auto nzw = readln.chomp.split.map!(to!int);
  n = nzw[0];
  int z = nzw[1];
  int w = nzw[2];
  a = readln.chomp.split.map!(to!int).array;
  memo = new int[][][](2, n);
  done = new bool[][](2, n);
  auto ret = dfs(0, 0, z, w);
  writeln = abs(ret.front - ret.back);
}
