#include <bits/stdc++.h>
using namespace std;
class Debugger {
 public:
  Debugger(const std::string& _separator = ", ")
      : first(true), separator(_separator) {}
  template <typename ObjectType>
  Debugger& operator,(const ObjectType& v) {
    if (!first) cerr << separator;
    cerr << v;
    first = false;
    return *this;
  }
  ~Debugger() { cerr << "\n"; }

 private:
  bool first;
  string separator;
};
template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline ostream& operator<<(ostream& os, const vector<T>& v) {
  bool first = true;
  os << "[";
  for (unsigned long long i = 0; i < v.size(); i++) {
    if (!first) os << ", ";
    os << v[i];
    first = false;
  }
  return os << "]";
}
template <typename T>
inline ostream& operator<<(ostream& os, const set<T>& v) {
  bool first = true;
  os << "[";
  for (typename set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
template <typename T1, typename T2>
inline ostream& operator<<(ostream& os, const map<T1, T2>& v) {
  bool first = true;
  os << "[";
  for (typename map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
       ++ii) {
    if (!first) os << ", ";
    os << *ii;
    first = false;
  }
  return os << "]";
}
long long one[100010];
long long two[100010];
map<long long, long long> cnt;
map<long long, long long> koll;
long long fact(long long n, long long kol, long long m) {
  long long res = 1;
  for (long long i = 2; i <= n; i++) {
    long long cis = i;
    while (kol > 0 && cis % 2 == 0) {
      cis /= 2;
      kol--;
    }
    res = (res * cis) % m;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  ;
  long long n, m;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    one[i] = x;
    cnt[x]++;
  }
  for (long long i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    two[i] = x;
    cnt[x]++;
  }
  for (long long i = 1; i <= n; i++) {
    if (one[i] == two[i]) {
      koll[one[i]]++;
    }
  }
  cin >> m;
  long long ans = 1;
  for (auto i : cnt) {
    long long nuj = fact(i.second, koll[i.first], m);
    ans = (ans * nuj) % m;
  }
  cout << ans << "\n";
  return 0;
}
