using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Program { static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); int M1 = int.Parse(Console.ReadLine()); var A = ReadInts(); int M2 = int.Parse(Console.ReadLine()); var B = ReadInts(); var C = new int[N + 1].ToList(); int p = 0; foreach(var a in A) { p += a; C[p] = 1; } foreach(var b in B) { p -= b; C[p] = 1; } Console.WriteLine(N+1-C.Sum()); } static List ReadInts() { var strs = new List(Console.ReadLine().Split(' ')); return strs.ConvertAll(x => int.Parse(x)); } }