#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > v;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    v.push_back(make_pair(x, i));
  }
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    v.push_back(make_pair(x, i));
  }
  long long m;
  cin >> m;
  sort((v).begin(), (v).end());
  v.push_back(make_pair(0, 0));
  long long ans = 1;
  for (long long i = 0; i < 2 * n; i++) {
    long long j, k = 0;
    for (j = i; j < 2 * n && v[j].first == v[i].first; j++)
      if (v[j] == v[j + 1]) k++;
    long long val = 1;
    for (long long x = 1; x <= j - i; x++) {
      long long p = x;
      while (k && p % 2 == 0) {
        p /= 2;
        k--;
      }
      val = (val * p) % m;
    }
    i = j - 1;
    ans = (ans * val) % m;
  }
  cout << ans;
}
