#include #include #include using namespace std; using ll = long long; #include int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); ll n,d,t; cin>>n>>d>>t; ll ans = 0; map> memo; for(int i = 0;i>x; ll now = x % d; if(now<0) now += d; memo[now].push_back(x); } for(auto&itr:memo){ auto now = itr.second; sort(now.begin(),now.end()); ll prev = -1e18; for(int i = 0;i