#include <bits/stdc++.h>
using namespace std;
struct pt {
  long long x, y;
};
vector<pt> v;
bool cmp1(pt a, pt b) { return a.x < b.x; }
long long mod;
long long c(long long n, long long k) {
  long long res = 1LL;
  if (k == 1LL) {
    return n % mod;
  } else if (k == 2 * 1LL) {
    return (((n) * (n - 1LL)) / (2 * 1LL)) % mod;
  }
}
int main() {
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    pt p;
    p.y = i;
    cin >> p.x;
    v.push_back(p);
  }
  for (long long i = 1; i <= n; i++) {
    pt p;
    p.y = i;
    cin >> p.x;
    v.push_back(p);
  }
  cin >> mod;
  sort(v.begin(), v.end(), cmp1);
  long long res = 1LL;
  for (long long i = 0; i < 2 * n;) {
    long long j = i;
    while (j < 2 * n && v[j].x == v[i].x) j++;
    map<long long, long long> mm;
    map<long long, long long>::iterator it2;
    vector<long long> s;
    for (long long k = i; k < j; k++) mm[v[k].y]++;
    long long cur = j - i;
    for (it2 = mm.begin(); it2 != mm.end(); it2++) s.push_back(it2->second);
    for (i = 0; i < (int)s.size(); i++) {
      res = (res * c(cur, s[i])) % mod;
      cur -= s[i];
    }
    i = j;
  }
  cout << res;
}
