// By SnowDream #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1e6+10; string s,tmp; int n,q,l,r; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> q; cin >> s; while(q--) { cin >> l >> r; tmp= ""; for(int i=l-1;i<r;i++) { string tmp1(2,s[i]); tmp+=tmp1; } s.replace(l-1,r-l+1,tmp); } cout << s; cout <<"\n"; return 0; }