#include #include using namespace std; typedef long long ll; using namespace atcoder; typedef modint mint; int main(){ int N,P,Q; cin >> N >> P >> Q; mint::set_mod(P); vector A; for(int i=0;i> a; A.push_back(a); } sort(A.begin(),A.end()); ll result = 0; for(int i=0;i