#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair P; ll gcd(ll a, ll b){ if(b==0) return a; return gcd(b, a%b); } int main() { int n, m;ll k; cin>>n>>m>>k; char op; cin>>op; ll a[100001], b[100001]; for(int i=0; i>b[i], b[i]%=k; for(int i=0; i>a[i];a[i]%=k; } if(op=='+'){ ll ans=0; sort(b, b+m); for(int i=0; i mp1, mp2; for(int i=0; i