using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _01niz
{
    class Program
    {
        static void okreni(ref string s, int l,int r)
        {
            string p = "";
            for (int i= 0; i< s.Length; i++)
            {
                if (i >= l && i <= r)
                {
                    if (s[i].ToString() == "0") p = p + "1";
                    else if (s[i].ToString() == "1") p = p + "0";
                }
                else p = p + s[i];
            }
            s = p;
        }
        static int min(string s, int c, int n)
        {
            int l = 0;
            int r = n - 1;
            bool p = true;
            int bj = 0;
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i].ToString() == "1") bj++;
                if (s[i].ToString() == "1" && p)
                {
                    l = i;
                    p = false;
                }
                if (s[i].ToString() == "1" && !p) r = i;
            }
            if (bj <= c) return bj;
            else
            {
                int x = 0;
                okreni(ref s, l, r);
                x = c;
                for (int i = 0; i < n; i++) if (s[i].ToString() == "1") x++;
                if (bj < x) return bj;
                else return x;
            }
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse(str[0]);
            int c = int.Parse(str[1]);
            int q = int.Parse(str[2]);
            string s = Console.ReadLine();
            int[] l = new int[q];
            int[] r = new int[q];
            for (int i=0; i< q; i++)
            {
                string[] s1 = Console.ReadLine().Split();
                l[i] = int.Parse(s1[0]);
                r[i] = int.Parse(s1[1]);
            }
            for (int i = 0; i < q; i++)
            {
                string s1 = s;
                okreni(ref s1, l[i] - 1, r[i] - 1);
                s = s1;
                Console.WriteLine(min(s1, c, n));
            }
        }
    }
}