#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const ll MAX = 100009 ;
ll tree[5*MAX] = {0};
ll lazy[5*MAX] = {0};
void update(ll node , ll left , ll right , ll from , ll to , ll val)
{
if(lazy[node] != 0)
{
tree[node] += (right-left+1) * lazy[node];
if (left != right)
{
lazy[2*node] += lazy[node];
lazy[2*node+1] += lazy[node];
}
lazy[node] = 0;
}
if (left > right || left > to || right < from)
return ;
if(left >= from && right <= to)
{
tree[node] += (right-left+1)*val;
if(left != right)
{
lazy[2*node] += val ;
lazy[2*node+1] += val ;
}
return ;
}
ll mid = (left + right) >> 1 ;
update(node*2 , left , mid , from , to , val);
update(2*node+1,mid+1,right,from,to,val);
tree[node] = tree[2*node] + tree[2*node+1];
}
ll query(ll node , ll left, ll right, ll from, ll to)
{
if(lazy[node] != 0)
{
tree[node] += (right - left + 1) * lazy[node];
if(left != right)
{
lazy[2*node] += lazy[node];
lazy[2*node+1] += lazy[node];
}
lazy[node] = 0 ;
}
if(left > right || left > to || right < from)
return 0 ;
if(left >= from && right <= to)
return tree[node];
ll mid = (left + right) >> 1 ;
return query(2*node , left , mid , from , to) +
query(2*node+1,mid+1,right,from,to);
}
int main()
{
ll t ;
scanf("%lld" , &t);
ll cnt = 0;
while(t--)
{
for(int i = 0 ; i < 5*MAX ; ++i)
lazy[0] = tree[0] = 0 ;
ll n , q ;
scanf("%lld %lld" , &n , &q);
ll arr[100005] = {0};
cout<<"Scenario #"<<++cnt<<":\n";
while(q--)
{
string s; ;
ll x ,y ;
cin>>s>>x>>y;
if(x > y)
cout<<"0\n";
else if(s[0] == 'a')
cout<<query(1,0,n-1,x-1,y-1)<<"\n";
else
{
update(1,0,n-1,x-1,y-1,1);
cout<<"OK\n";
}
}
}
return 0 ;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGwgOwoKCmNvbnN0IGxsIE1BWCA9IDEwM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oKbGwgcXVlcnkobGwgbm9kZSAsIGxsIGxlZnQsIGxsIHJpZ2h0LCBsbCBmcm9tLCBsbCB0bykKewogICAgaWYobGF6eVtub2RlXSAhPSAwKQogICAgewogICAgICAgIHRyZWVbbm9kZV0gKz0gKHJpZ2h0IC0gbGVmdCArIDEpICogbGF6eVtub2RlXTsKICAgICAgICBpZihsZWZ0ICE9IHJpZ2h0KQogICAgICAgIHsKICAgICAgICAgICAgbGF6eVsyKm5vZGVdICs9IGxhenlbbm9kZV07CiAgICAgICAgICAgIGxhenlbMipub2RlKzFdICs9IGxhenlbbm9kZV07CiAgICAgICAgfQogICAgICAgIGxhenlbbm9kZV0gPSAwIDsKICAgIH0KICAgIGlmKGxlZnQgPiByaWdodCB8fCBsZWZ0ID4gdG8gfHwgcmlnaHQgPCBmcm9tKQogICAgICAgIHJldHVybiAwIDsKCiAgICBpZihsZWZ0ID49IGZyb20gJiYgcmlnaHQgPD0gdG8pCiAgICAgICAgcmV0dXJuIHRyZWVbbm9kZV07CgogICAgbGwgbWlkID0gKGxlZnQgKyByaWdodCkgPj4gMSA7CiAgICByZXR1cm4gcXVlcnkoMipub2RlICwgbGVmdCAsIG1pZCAsIGZyb20gLCB0bykgKwogICAgICAgICAgIHF1ZXJ5KDIqbm9kZSsxLG1pZCsxLHJpZ2h0LGZyb20sdG8pOwp9CgppbnQgbWFpbigpCnsKICAgIGxsIHQgOwogICAgc2NhbmYoIiVsbGQiICwgJnQpOwogICAgbGwgY250ID0gMDsKICAgIHdoaWxlKHQtLSkKICAgIHsKICAgICAgICBmb3IoaW50IGkgPSAwIDsgaSA8IDUqTUFYIDsgKytpKQogICAgICAgICAgICBsYXp5WzBdID0gdHJlZVswXSA9IDAgOwogICAgICAgIGxsIG4gLCBxIDsKICAgICAgICBzY2FuZigiJWxsZCAlbGxkIiAsICZuICwgJnEpOwogICAgICAgIGxsIGFyclsxMDAwMDVdID0gezB9OwogICAgICAgIGNvdXQ8PCJTY2VuYXJpbyAjIjw8KytjbnQ8PCI6XG4iOwogICAgICAgIHdoaWxlKHEtLSkKICAgICAgICB7CiAgICAgICAgICAgIHN0cmluZyBzOyA7CiAgICAgICAgICAgIGxsIHggLHkgOwogICAgICAgICAgICBjaW4+PnM+Png+Pnk7CiAgICAgICAgICAgIGlmKHggPiB5KQogICAgICAgICAgICAgICAgY291dDw8IjBcbiI7CiAgICAgICAgICAgIGVsc2UgaWYoc1swXSA9PSAnYScpCiAgICAgICAgICAgICAgIGNvdXQ8PHF1ZXJ5KDEsMCxuLTEseC0xLHktMSk8PCJcbiI7CiAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgewogICAgICAgICAgICAgICAgdXBkYXRlKDEsMCxuLTEseC0xLHktMSwxKTsKICAgICAgICAgICAgICAgIGNvdXQ8PCJPS1xuIjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgICByZXR1cm4gMCA7Cn0K