OJ-Problems-Source/QUSTOJ/1871.cpp
2016-10-24 17:19:04 +08:00

19 lines
262 B
C++

#include <iostream>
using namespace std;
int main()
{
int x,y,n,m;
cin>>x>>y>>n>>m;
while(m--)
{
int t;
cin>>t;
n+=t;
while(n<x) n+=y-x+1;
while(n>y) n-=y-x+1;
cout<<n<<endl;
}
return 0;
}