Problem: You have 4 bags A, B, C and D each of which includes N coins (there are totally 4N coins). Values of the coins in each bag are ai, bi, ci and di respectively.

Find the number of combinations that result when you choose one coin from each bag (totally 4 coins) in such a way that the total value of the coins is V. You should distinguish the coins in a bag.

Constraints

* 1 ≤ N ≤ 1000
* 1 ≤ ai, bi, ci, di ≤ 1016
* 1 ≤ V ≤ 1016
* All input values are given in integers

Input

The input is given in the following format.


N V
a1 a2 ... aN
b1 b2 ... bN
c1 c2 ... cN
d1 d2 ... dN


Output

Print the number of combinations in a line.

Examples

Input

3 14
3 1 2
4 8 2
1 2 3
7 3 2


Output

9


Input

5 4
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1


Output

625

Solution (in CPP):

Solution:
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//akari : 1D, yukari : 2D, maki : 3D vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//akane : ascending order, aoi : decending order
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n;
    i64 v;
    cin >> n >> v;
    akari<i64> as(n), bs(n), cs(n), ds(n);
    for (int i = 0; i < n; i++)
        cin >> as[i];
    for (int i = 0; i < n; i++)
        cin >> bs[i];
    for (int i = 0; i < n; i++)
        cin >> cs[i];
    for (int i = 0; i < n; i++)
        cin >> ds[i];
    map<i64, i64> mp[2];
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            mp[0][as[i] + bs[j]]++;
        }
    for (int i = 0; i < n; i++)
        for (int j = 0; j < n; j++)
        {
            mp[1][cs[i] + ds[j]]++;
        }
    i64 ans = 0;
    for (auto &p : mp[0])
    {
        ans += mp[1][v - p.first] * p.second;
    }
    cout << ans << endl;
}

int main()
{
    solve();
    return 0;
}