#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
typedef __int128 i128;
ll gcd(ll a, ll b) {
while(b) { a %= b; swap(a, b); }
return a;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int c, T;
cin >> c >> T;
while(T--) {
ll d, n, m, t;
cin >> d >> n >> m >> t;
vector<ll> a(n), pre(n + 1, 0);
for(int i = 0; i < n; i++) {
cin >> a[i];
pre[i + 1] = (pre[i] + a[i]) % d;
}
ll total_sum = (pre[n] + d) % d;
}