#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL
const int N = 1e3 + 5;
int dp[N][N][2];
vector<int> v(N);
const int maxn = 2e5 + 5;
int seg[4*N];
int lazy[4*N];
int n;
int q;
int c;

int build(int node, int l, int r)
{
    if(l==r)
    {
        seg[node] = v[l];
        return seg[node];
    }
    int mid = (l+r)/2;
    return seg[node] = build(node*2+1, l, mid) + build(node*2+2, mid+1, r);
}

void update(int node, int l, int r, int i, int j)
{
    if(lazy[node])
    {
        if(lazy[node]%2==1)
        {
            seg[node] = j - i + 1 - seg[node];
            if(i!=j)
            {
                int mid = (i+j)>>1;
                lazy[node*2+1]++;
                lazy[node*2+2]++;
            }
        }
        lazy[node] = 0;
    }
    if(i>r||j<l) return;
    if(i>=l&&j<=r)
    {
        seg[node] = j - i + 1 - seg[node];
        if(i!=l)
        {
            int mid = (i+j)>>1;
                lazy[node*2+1]++;
                lazy[node*2+2]++;
        }
        return;
    }
    int mid = (i+j)/2;
    update(node*2+1, l, r, i, mid);
    update(node*2+2, l, r, mid+1, j);
    seg[node] = seg[node*2+1] + seg[node*2+2];
}

int get_sum(int node, int l, int r, int i, int j)
{
    if(lazy[node])
    {
        if(lazy[node]%2==1)
        {
            seg[node] = j - i + 1 - seg[node];
            if(i!=j)
            {
                int mid = (i+j)>>1;
                lazy[node*2+1]++;
                lazy[node*2+2]++;
            }
        }
        lazy[node] = 0;
    }
    if(i>r||j<l) return 0;
    if(i>=l&&j<=r) return seg[node];
    int mid = (i+j)/2;
    return get_sum(node*2+1, l, r, i, mid) + get_sum(node*2+2, l, r, mid+1, j);
}


void resi(int l, int r)
{
    if(l>r)
    {
        dp[l][r][0] = 0;
        dp[l][r][1] = 0;
        return;
    }
    if(l==r)
    {
        if(v[l]==1) dp[l][l][0] = 1, dp[l][l][1] = 0;
        else dp[l][l][0] = 0, dp[l][l][1] = 1;
        return;
    }
    if(dp[l][l][0]!=-1) return;
    if(v[l]==v[r])
    {
        resi(l+1, r-1);
        if(v[l]==1)
        {
            dp[l][r][1] = dp[l+1][r-1][1];
            dp[l][r][0] = min(2+dp[l+1][r-1][0], c + dp[l+1][r-1][1]);
        }
        else
        {
            dp[l][r][0] = dp[l+1][r-1][0];
            dp[l][r][1] = min(dp[l+1][r-1][1]+2, dp[l+1][r-1][0]+c);
        }
    }
    else
    {
        resi(l+1, r);
        resi(l, r-1);
        if(v[r]==1)
        {
            dp[l][r][1] = min(dp[l][r-1][1], min(1+dp[l+1][r][1], c+dp[l+1][r][0]));
            dp[l][r][0] = min(dp[l+1][r][0], min(1+dp[l][r-1][0], c+dp[l][r-1][1]));
        }
        else
        {
            dp[l][r][1] = min(dp[l+1][r][1], min(1+dp[l][r-1][1], c+dp[l][r-1][0]));
            dp[l][r][0] = min(dp[l][r-1][0], min(1+dp[l+1][r][0], c+dp[l+1][r][1]));
        }
    }
}
string s;

int main()
{
    ios
    cin>>n>>c>>q;
    cin>>s;
    for(int i = 1;i<=n;i++)
    {
        v[i] = s[i-1] - '0';
    }
    if(q==1&&n<=1000)
    {
    int l, r;
    cin>>l>>r;
    for(int i = l;i<=r;i++) v[i]^=1;
    for(int i = 0;i<=n;i++)
    {
        for(int j = 0;j<=n;j++)
        {
            dp[i][j][1] = dp[i][j][0] = -1;
        }
    }

    resi(1, n);
    cout<<dp[1][n][0]<<endl;
    }
    else
    {
        while(q--)
        {
            int l, r;
            cin>>l>>r;
            update(0, l, r, 1, n);
            cout<<get_sum(0, 1, n, 1, n)<<endl;
        }
    }





    return 0;
}