using System;
using System.Collections.Generic;

class Program {
	static void Main(string[] args) {
		List<Slime> slimes = new List<Slime>();
		int slimeCount = int.Parse(Console.ReadLine());
		string[] slimeInfo = Console.ReadLine().Split(' ');
		for(int i=0; i<slimeCount; i++) {
			slimes.Add(new Slime(int.Parse(slimeInfo[i])));
		}
		int[] movings = new int[slimeCount - 1];
		for(int i=0; i<slimeCount-1; i++) {
			int k = int.Parse(Console.ReadLine());
			movings[i] = slimes[k].x - slimes[k - 1].x;
			slimes.RemoveAt(k - 1);
		}
		
		int movingAll = 0;
		foreach(int m in movings) {
			movingAll += m;
		}
		double average = (double)movingAll / slimeCount;
		Console.WriteLine(average * Kaijo(slimeCount-1) % (1000000000 + 7));
	}
	
	static int Kaijo(int x) {
		int result = 1;
		for(int i=0; i<x; i++) {
			result = result * (i + 1);
		}
		return result;
	}
	
	class Slime {
		public Slime(int _x) {
			x = _x;
		}
		public int x;
	}
}