Quadruplet Sum - 2

medium
1. You are given four arrays(A1,A2,A3,A4) of integers. All arrays are of same length(N).
2. You have to find the count of all unique quadruplets(a,b,c,d) such that - 
   A1[a] + A2[b] + A3[c] + A4[d] = 0.

Input Format

5 lines, where the first line contains a number N, And every next line contains N space-separated integers.

Output Format

A number representing the count of all unique quadruplets having sum zero.

Constraints

1 <= N <= 200
-10^3 <= elements of all arrays <= 10^3

Example

Input
2
1 2
-2 -1
-1 2
0 2
Output
2
Previous
Quadruplet Sum
Next
Powerful Number

Related Questions