#include <bits/stdc++.h>

using namespace std;

int count_zeroes(char coins[], int n)
{
    int c = 0;
    for (int i = 0; i < n; i++)
    {
        if(coins[i] == '0')
            c++;
    }
    return c;
}

int zero_count = INT_MIN;
void brute_force(char coins[], char temp_coins[], int n, int f, int t)
{
    // Flip range.
    for(int i = f; i < t; i++)
    {
        coins[i] = (coins[i] == '0' ? '1' : '0');
    }

    // Check if better has been found.
    int new_zero_count = count_zeroes(coins, n);
    if (new_zero_count > zero_count)
    {
        zero_count = new_zero_count;
        for(int i = 0; i < n; i++)
        {
            temp_coins[i] = coins[i];
        }
    }

    // Flip range back.
    for(int i = f; i < t; i++)
    {
        coins[i] = (coins[i] == '0' ? '1' : '0');
    }

    if(zero_count != n)
    {
        for(int i = t; i > -1; i--)
        {
            if (f+1 < i)
                brute_force(coins, temp_coins, n, f+1, i);
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int n, c, t;
    cin >> n >> c >> t;
    char coins[n];
    char temp_coins[n];
    int Li[t];
    int Ri[t];

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

    for(int i = 0; i < t; i++)
    {
        cin >> Li[i] >> Ri[i];
    }

    for(int i = 0; i < t; i++)
    {
        int n_adjacent_ones = 0;
        int temp_price_one = 0;
        int temp_price_two = 0;
        for(int j=0; j < n; j++)
        {
            if (j+1 >= Li[i] && j+1 <= Ri[i])
                coins[j] = (coins[j] == '0' ? '1' : '0');

            if (coins[j] == '1')
            {
                n_adjacent_ones++;
                if (j+1 == n)
                {
                    if (n_adjacent_ones > c)
                        temp_price_one += c;
                    else
                        temp_price_one += n_adjacent_ones;
                }
            }
            else
            {
                if (n_adjacent_ones > c)
                    temp_price_one += c;
                else
                    temp_price_one += n_adjacent_ones;
                n_adjacent_ones = 0;
            }
        }

        brute_force(coins, temp_coins, n, 0, n);
        temp_price_two = c;
        for(int i = 0; i < n; i++)
        {
            if (temp_coins[i] == '1')
                temp_price_two++;
        }

        cout << min(temp_price_one, temp_price_two) << "\n";
    }

    return 0;
}