#include <bits/stdc++.h>
using namespace std;
int n, m, a[100100], b[100100];
map<int, int> cnt;
map<int, int> flag;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
    if (b[i] == a[i]) flag[a[i]]++;
    cnt[b[i]]++;
  }
  scanf("%d", &m);
  long long ans = 1;
  int tmp;
  for (__typeof(cnt.begin()) it(cnt.begin()); it != cnt.end(); it++) {
    for (int i = 1; i <= it->second; i++) {
      tmp = i;
      while (tmp % 2 == 0 and flag[it->first] > 0) {
        flag[it->first]--;
        tmp /= 2;
      }
      ans = (ans * tmp) % m;
    }
  }
  cout << ans << endl;
  ;
  return 0;
}
