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>
1 1 2
1
1
 1 1 1
1
1
 3 3 4
2 3 2
3 2 2
 5 5 6
1 2 3 4 5
5 4 3 2 1
 3 3 7
3 4 3
3 4 3

1
 0
 2
 1
 1

#include <bits/stdc++.h>
const long long P = 1e9 + 7;
using namespace std;
template <typename T>
inline void ckmax(T &a, T b) {
  (a < b) && (a = b);
}
template <typename T>
inline void ckmin(T &a, T b) {
  (a > b) && (a = b);
}
inline long long mul(long long a, long long b) { return 1ull * a * b % P; }
inline long long add(long long a, long long b) {
  return a + b >= P ? a + b - P : a + b;
}
inline long long sub(long long a, long long b) {
  return a - b >= 0 ? a - b : a - b + P;
}
inline void mulmod(long long &a, long long b) { a = mul(a, b); }
inline void addmod(long long &a, long long b) { ((a += b) >= P) && (a -= P); }
inline void submod(long long &a, long long b) { ((a -= b) < 0) && (a += P); }
inline long long ksm(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = 1ll * ans * a % P;
    a = 1ll * a * a % P;
  }
  return ans;
}
inline void fprint(const long long &x, char c = ' ') {
  fprintf(stderr, "%d%c", x, c);
}
inline void fprint(const pair<long long, long long> &x, char c = '\n') {
  fprintf(stderr, "%d %d%c", x.first, x.second, c);
}
inline void fprint(const long long *f, const long long &n, char c = '\n') {
  for (long long i = 1; i <= n; i++) fprint(f[i]);
  fprintf(stderr, "%c", c);
}
inline void fprint(const vector<long long> &f, char c = '\n') {
  for (long long i = 0; i < (long long)f.size(); i++) fprint(f[i]);
  fprintf(stderr, "%c", c);
}
inline long long inv(long long a) { return ksm(a, P - 2); }
namespace FastIO {
const long long SIZE = 1 << 16;
char buf[SIZE], obuf[SIZE], str[64];
long long bi = SIZE, bn = SIZE, opt;
long long read(char *s) {
  while (bn) {
    for (; bi < bn && buf[bi] <= ' '; bi++)
      ;
    if (bi < bn) break;
    bn = fread(buf, 1, SIZE, stdin), bi = 0;
  }
  long long sn = 0;
  while (bn) {
    for (; bi < bn && buf[bi] > ' '; bi++) s[sn++] = buf[bi];
    if (bi < bn) break;
    bn = fread(buf, 1, SIZE, stdin), bi = 0;
  }
  s[sn] = 0;
  return sn;
}
bool read(long long &x) {
  if (x) x = 0;
  long long bf = 0, n = read(str);
  if (!n) return 0;
  long long i = 0;
  if (str[i] == '-') bf = 1, i = 1;
  for (x = 0; i < n; i++) x = x * 10 + str[i] - '0';
  if (bf) x = -x;
  return 1;
}
void write(long long x) {
  if (!x)
    obuf[opt++] = '0';
  else {
    if (x < 0) obuf[opt++] = '-', x = -x;
    long long sn = 0;
    while (x) str[sn++] = x % 10 + '0', x /= 10;
    for (long long i = sn - 1; i >= 0; i--) obuf[opt++] = str[i];
  }
  if (opt >= (SIZE >> 1)) {
    fwrite(obuf, 1, opt, stdout);
    opt = 0;
  }
}
void write(char x) {
  obuf[opt++] = x;
  if (opt >= (SIZE >> 1)) {
    fwrite(obuf, 1, opt, stdout);
    opt = 0;
  }
}
void Fflush() {
  if (opt) fwrite(obuf, 1, opt, stdout);
  opt = 0;
}
};  // namespace FastIO
inline long long read() {
  long long x;
  FastIO::read(x);
  return x;
}
const long long MN = 2e5 + 5;
long long n, a[MN], b[MN], m, x, p[MN], q[MN], T = 2e5 + 1;
long long s[MN], top, mx[MN];
void solve(long long *a, long long n, long long *ans) {
  for (long long i = (1); i <= (n); i++) ans[i] = T;
  top = 0;
  reverse(a + 1, a + 1 + n);
  for (long long i = (1); i <= (n); i++) {
    long long nmx = a[i];
    while (top && a[s[top]] >= a[i]) {
      ckmax(nmx, mx[top]);
      top--;
    }
    if (top) ckmin(ans[n - i + 1], nmx);
    mx[++top] = nmx, s[top] = i;
  }
  top = 0;
  reverse(a + 1, a + 1 + n);
  for (long long i = (1); i <= (n); i++) {
    long long nmx = a[i];
    while (top && a[s[top]] > a[i]) {
      ckmax(nmx, mx[top]);
      top--;
    }
    if (top) ckmin(ans[i], nmx);
    mx[++top] = nmx, s[top] = i;
  }
}
pair<long long, long long> A[MN], B[MN];
struct BIT {
  static const long long N = MN;
  long long c[N];
  void upd(long long x, long long v) {
    x++;
    for (; x <= T + 1; x += x & -x) c[x] += v;
  }
  long long qry(long long x) {
    x++;
    long long ans = 0;
    for (; x; x -= x & -x) ans += c[x];
    return ans;
  }
} tr;
bool cmp(pair<long long, long long> x, pair<long long, long long> y) {
  if (y.second != x.second) return x.second > y.second;
  return x.first < y.first;
}
void works() {
  n = read(), m = read(), x = read();
  for (long long i = (1); i <= (n); i++) a[i] = read();
  for (long long i = (1); i <= (m); i++) b[i] = read();
  solve(a, n, p);
  solve(b, m, q);
  for (long long i = (1); i <= (n); i++) A[i] = make_pair(a[i], p[i]);
  for (long long i = (1); i <= (m); i++) B[i] = make_pair(b[i], q[i]);
  sort(A + 1, A + 1 + n);
  sort(B + 1, B + 1 + m, cmp);
  long long ans = 0;
  long long now = 1;
  for (long long i = (1); i <= (n); i++) {
    if (A[i].first > x) continue;
    while (now <= m && B[now].second > x - A[i].first) {
      tr.upd(B[now].first, 1);
      now++;
    }
    ans += tr.qry(x - A[i].first) - tr.qry(max(x - A[i].second, 0ll));
  }
  cout << ans << endl;
}
signed main() {
  long long T = 1;
  while (T--) {
    works();
  }
  return FastIO::Fflush(), 0;
}
