ROTATION : getting WA

#include
#define MOD 1000000009

using namespace std;

int a[100009];

int main()
{
int n,m,i;
char x;
int y,r,t;
r=0;
cin>>n>>m;

for(i=0;i<n;i++)
{
    cin>>a[i];
}

while(m--)
{
    cin>>x>>y;
    if(x=='C')
    {
        r=(r+y)%n;
    }
    else if(x=='A')
    {
        r=(r-y)%n;
    }
    else if(x=='R')
    {
        t=(r+y-1)%n;
        cout<<a[t]<<endl;
    }
}
return 0;

}

have a look at this :-

ideone link

thanks i misinterpreted mod operator