import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.StringTokenizer;

public class moscow_sm {
	final int MAXANGLE = 360 * 1000 * 1000;

	private void solve() {
		int n = nextInt(1, 100000);
		int m = nextInt(1, 100000);
		int[] r = new int[n];
		int[] d = new int[n];
		for (int i = 0; i < n; i++) {
			r[i] = nextInt(1, 1000000);
			d[i] = nextInt(-1, 1);
		}
		int[] a = new int[m];
		for (int i = 0; i < m; i++) {
			a[i] = nextInt(0, MAXANGLE);
		}
		int is = nextInt(1, n) - 1;
		int js = nextInt(1, m) - 1;
		int it = nextInt(1, n) - 1;
		int jt = nextInt(1, m) - 1;
		double best = Double.POSITIVE_INFINITY;
		for (int i = 0; i < r.length; i++) {
			double res = Math.abs(r[i] - r[is]) + Math.abs(r[i] - r[it]);
			res += dist(a[js], a[jt], r[i], d[i]);
			best = Math.min(best, res);
		}
		out.printf(Locale.US, "%.6f\n", best);
	}

	double dist(int a1, int a2, int r, int d) {
		if (d == 0) {
			return Math.min(dist(a1, a2, r, -1), dist(a1, a2, r, 1));
		}
		final double delta;
		if (d == 1) {
			if (a1 > a2) {
				a2 += MAXANGLE;
			}
			delta = a2 - a1;
		} else if (d == -1) {
			if (a1 < a2) {
				a2 -= MAXANGLE;
			}
			delta = a1 - a2;
		} else {
			throw new AssertionError();
		}
		return (delta / 1000000 / 180 * Math.PI) * r;
	}

	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;

	public void run() {
		try {
			br = new BufferedReader(new FileReader("moscow.in"));
			out = new PrintWriter("moscow.out");
			solve();
			out.close();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}

	}

	int nextInt(int a, int b) {
		int x = Integer.parseInt(nextToken());
		if (x < a || x > b)
			throw new AssertionError();
		return x;
	}

	String nextToken() {
		try {
			while (st == null || !st.hasMoreTokens()) {
				st = new StringTokenizer(br.readLine());
			}
			return st.nextToken();
		} catch (IOException e) {
			return "0";
		}
	}

	public static void main(String[] args) {
		new moscow_sm().run();
	}
}
