#include <bits/stdc++.h>
using namespace std;
map<long long, int> mp;
vector<long long> v[210000];
int main() {
  int n;
  cin >> n;
  int ind = 0;
  for (int(i) = 0; (i) < (n); (i)++) {
    long long k;
    cin >> k;
    if (mp.find(k) == mp.end()) mp[k] = ind++;
    int u = mp[k];
    v[u].push_back(i + 1);
  }
  for (int(i) = 0; (i) < (n); (i)++) {
    long long k;
    cin >> k;
    if (mp.find(k) == mp.end()) mp[k] = ind++;
    int u = mp[k];
    v[u].push_back(i + 1);
  }
  long long mod;
  cin >> mod;
  long long res = 1;
  for (int(i) = 0; (i) < (ind); (i)++) {
    sort((v[i]).begin(), (v[i]).end());
    int count = v[i].size();
    int two = 0;
    for (int(j) = (1); (j) < (v[i].size()); (j)++)
      if (v[i][j] == v[i][j - 1]) two++;
    for (int(j) = (1); (j) < (count + 1); (j)++) {
      int k = j;
      if (k % 2 == 0 && two > 0) {
        k /= 2;
        two--;
      }
      res = (res * k) % mod;
    }
  }
  cout << res << endl;
}
