#include using namespace std; int main() { int N; cin >> N; int M1; cin >> M1; vector A(M1); for (int i = 0; i < M1; i++){ cin >> A[i]; } int M2; cin >> M2; vector B(M2); for (int i = 0; i < M2; i++){ cin >> B[i]; } vector flg(N + 1); flg[0] = true; int c = 0; for (int i = 0; i < M1; i++){ c += A[i]; flg[c] = true; } for (int i = 0; i < M1; i++){ c -= B[i]; flg[c] = true; } cout << count(flg.begin(), flg.end(), false) << '\n'; }