#include <cstdio>
#include <cmath>
#include <algorithm>

using std::min;

#ifndef M_PI // on outdated compilers there is no M_PI
  #warning no M_PI, redefining
  #define M_PI 3.1415926535897932384626433832
#endif

const int modulo = 360000000;
const long double koef = M_PI / 1.8e8;

int main()
{
  freopen("moscow.in", "r", stdin);
  freopen("moscow.out", "w", stdout);

  int n, m, k = 0;
  scanf("%d%d", &n, &m);
  int *r = new int[2 * n], *dir = new int[2 * n], *ang = new int[m], *ind = new int[n];
  for (int i = 0; i < n; i++)
  {
    scanf("%d%d", &r[i], &dir[i]);
    ind[k++] = i;
    if (dir[i] == 0)
    {
      dir[i] = 1, dir[i + 1] = -1;
      r[i + 1] = r[i];
      i++, n++;
    }
  }
  for (int i = 0; i < m; i++)
    scanf("%d", &ang[i]);
  int i_s, j_s, i_t, j_t;
  scanf("%d%d", &i_s, &j_s), i_s = ind[i_s - 1], j_s--;
  scanf("%d%d", &i_t, &j_t), i_t = ind[i_t - 1], j_t--;
  long double ans = 1e100;
  for (int i = 0; i < n; i++)
  {
    long double tmp = fabsl(r[i_s] - r[i]) + fabsl(r[i_t] - r[i]);
    int go;
    if (dir[i] > 0)
      go = (ang[j_t] - ang[j_s] + modulo) % modulo;
    else
      go = (ang[j_s] - ang[j_t] + modulo) % modulo;
    tmp += koef * r[i] * go;
    ans = min(ans, tmp);
  }
  printf("%.20lf\n", (double)(ans));

  return 0;
}

