#include <bits/stdc++.h>
using namespace std;
const int N = 200000, C = 19, INF = (1 << 30) - 1;
int n, m, sk, a[N + 9], b[N + 9];
void into() {
  scanf("%d%d%d", &n, &m, &sk);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
}
int lg[N + 9], mx[C][N + 9];
void Get_mx(int n, int *a) {
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1; i <= n; ++i) mx[0][i] = a[i];
  for (int i = 1; i < C; ++i)
    for (int j = 1; j + (1 << i) - 1 <= n; ++j)
      mx[i][j] = max(mx[i - 1][j], mx[i - 1][j + (1 << i - 1)]);
}
int Query_max(int l, int r) {
  int t = lg[r - l + 1];
  return max(mx[t][l], mx[t][r - (1 << t) + 1]);
}
struct question {
  int x, y, id;
  question(int X = 0, int Y = 0, int Id = 0) {
    x = X;
    y = Y;
    id = Id;
  }
} q[N * 2 + 9];
int cq;
int sta[N + 9], cst;
void Get_d(int n, int *a, int id) {
  Get_mx(n, a);
  static int tmp[N + 9];
  cst = 0;
  for (int i = 1; i <= n; ++i) {
    tmp[i] = INF;
    for (; cst && a[i] <= a[sta[cst]]; --cst)
      ;
    if (cst) tmp[i] = min(tmp[i], Query_max(sta[cst] + 1, i));
    sta[++cst] = i;
  }
  cst = 0;
  for (int i = n; i >= 1; --i) {
    for (; cst && a[i] < a[sta[cst]]; --cst)
      ;
    if (cst) tmp[i] = min(tmp[i], Query_max(i, sta[cst] - 1));
    sta[++cst] = i;
  }
  for (int i = 1; i <= n; ++i) q[++cq] = question(a[i], tmp[i], id);
}
int c[2][N + 9];
void Add(int id, int p) {
  for (; p <= N; p += p & -p) ++c[id][p];
}
int Query(int id, int p) {
  int res = 0;
  for (; p; p -= p & -p) res += c[id][p];
  return res;
}
int Query(int id, int l, int r) { return Query(id, r) - Query(id, l - 1); }
long long ans;
void Get_ans() {
  sort(q + 1, q + cq + 1, [&](const question &a, const question &b) {
    return a.y - a.x > b.y - b.x;
  });
  for (int i = 1; i <= cq; ++i) {
    auto [x, y, id] = q[i];
    if (x <= y && x <= sk) ans += Query(id ^ 1, max(sk - y + 1, 1), sk - x);
    Add(id, x);
  }
}
void work() {
  Get_d(n, a, 0);
  Get_d(m, b, 1);
  Get_ans();
}
void outo() { printf("%lld\n", ans); }
int main() {
  int T = 1;
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

Two painters, Amin and Benj, are repainting Gregor's living room ceiling! The ceiling can be modeled as an n × m grid.

For each i between 1 and n, inclusive, painter Amin applies a_i layers of paint to the entire i-th row. For each j between 1 and m, inclusive, painter Benj applies b_j layers of paint to the entire j-th column. Therefore, the cell (i,j) ends up with a_i+b_j layers of paint.

Gregor considers the cell (i,j) to be badly painted if a_i+b_j ≤ x. Define a badly painted region to be a maximal connected component of badly painted cells, i. e. a connected component of badly painted cells such that all adjacent to the component cells are not badly painted. Two cells are considered adjacent if they share a side.

Gregor is appalled by the state of the finished ceiling, and wants to know the number of badly painted regions.

Input

The first line contains three integers n, m and x (1 ≤ n,m ≤ 2⋅ 10^5, 1 ≤ x ≤ 2⋅ 10^5) — the dimensions of Gregor's ceiling, and the maximum number of paint layers in a badly painted cell.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 2⋅ 10^5), the number of paint layers Amin applies to each row.

The third line contains m integers b_1, b_2, …, b_m (1 ≤ b_j ≤ 2⋅ 10^5), the number of paint layers Benj applies to each column.

Output

Print a single integer, the number of badly painted regions.

Examples

Input


3 4 11
9 8 5
10 6 7 2


Output


2


Input


3 4 12
9 8 5
10 6 7 2


Output


1


Input


3 3 2
1 2 1
1 2 1


Output


4


Input


5 23 6
1 4 3 5 2
2 3 1 6 1 5 5 6 1 3 2 6 2 3 1 6 1 4 1 6 1 5 5


Output


6

Note

The diagram below represents the first example. The numbers to the left of each row represent the list a, and the numbers above each column represent the list b. The numbers inside each cell represent the number of paint layers in that cell.

The colored cells correspond to badly painted cells. The red and blue cells respectively form 2 badly painted regions.

<image>

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 200000, C = 19, INF = (1 << 30) - 1;
int n, m, sk, a[N + 9], b[N + 9];
void into() {
  scanf("%d%d%d", &n, &m, &sk);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= m; ++i) scanf("%d", &b[i]);
}
int lg[N + 9], mx[C][N + 9];
void Get_mx(int n, int *a) {
  for (int i = 2; i <= n; ++i) lg[i] = lg[i >> 1] + 1;
  for (int i = 1; i <= n; ++i) mx[0][i] = a[i];
  for (int i = 1; i < C; ++i)
    for (int j = 1; j + (1 << i) - 1 <= n; ++j)
      mx[i][j] = max(mx[i - 1][j], mx[i - 1][j + (1 << i - 1)]);
}
int Query_max(int l, int r) {
  int t = lg[r - l + 1];
  return max(mx[t][l], mx[t][r - (1 << t) + 1]);
}
struct question {
  int x, y, id;
  question(int X = 0, int Y = 0, int Id = 0) {
    x = X;
    y = Y;
    id = Id;
  }
} q[N * 2 + 9];
int cq;
int sta[N + 9], cst;
void Get_d(int n, int *a, int id) {
  Get_mx(n, a);
  static int tmp[N + 9];
  cst = 0;
  for (int i = 1; i <= n; ++i) {
    tmp[i] = INF;
    for (; cst && a[i] <= a[sta[cst]]; --cst)
      ;
    if (cst) tmp[i] = min(tmp[i], Query_max(sta[cst] + 1, i));
    sta[++cst] = i;
  }
  cst = 0;
  for (int i = n; i >= 1; --i) {
    for (; cst && a[i] < a[sta[cst]]; --cst)
      ;
    if (cst) tmp[i] = min(tmp[i], Query_max(i, sta[cst] - 1));
    sta[++cst] = i;
  }
  for (int i = 1; i <= n; ++i) q[++cq] = question(a[i], tmp[i], id);
}
int c[2][N + 9];
void Add(int id, int p) {
  for (; p <= N; p += p & -p) ++c[id][p];
}
int Query(int id, int p) {
  int res = 0;
  for (; p; p -= p & -p) res += c[id][p];
  return res;
}
int Query(int id, int l, int r) { return Query(id, r) - Query(id, l - 1); }
long long ans;
void Get_ans() {
  sort(q + 1, q + cq + 1, [&](const question &a, const question &b) {
    return a.y - a.x > b.y - b.x;
  });
  for (int i = 1; i <= cq; ++i) {
    auto [x, y, id] = q[i];
    if (x <= y && x <= sk) ans += Query(id ^ 1, max(sk - y + 1, 1), sk - x);
    Add(id, x);
  }
}
void work() {
  Get_d(n, a, 0);
  Get_d(m, b, 1);
  Get_ans();
}
void outo() { printf("%lld\n", ans); }
int main() {
  int T = 1;
  for (; T--;) {
    into();
    work();
    outo();
  }
  return 0;
}

```