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

namespace ConsoleApplication1
{
    class Program
    {
        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[] res = new int[q];
            // int[] b = new int[n];
            bool[] b = new bool[n];
            int i = 0;
            while (i < n)
            {
                if (s[i] == '1') b[i] = true;
                else b[i] = false;
               // b[i] = Convert.ToInt32(s[i])-48;
               i++;
            }
            i = 0;
            int j = 0;
            int p = 0;
            while (p < q)
            {
                str = Console.ReadLine().Split();
                int l = int.Parse(str[0]);
                int r = int.Parse(str[1]);
                j = l - 1;
                while (j <= r - l)
                {
                    b[j] = !b[j];
                   // Console.Write(b[j]);
                    j++;
                }
                j = 0;
                //MC = min_cena(b[i]);
                int T=0; 
                int t1=0; 
                int tn=0;
                int F=0;
                int f1=0;
                int fn=0;
                int MCt=0;
                int MCf=0;
                int MC = 0;

                if (b[0]) T=1;
                else F=1;

                for(i=1; i<n; i++)
                {
                    if(b[i])  // 1
                    {
                        T++;
                        if(b[i]!=b[i-1])
                        {
                            if(F!=0)
                            {
                                if(F>=c) fn++;
                                else f1=f1+F;
                                F=0;
                            }
                        }
                    }
                    else  // 0
                    {
                        if (b[i] != b[i - 1])
                        {
                            if (b[i] != b[i + 1])
                            {
                                T++;
                                MC = MC + 1;
                            }
                            else
                            {
                                F++;
                                if (T != 0)
                                {
                                    if (T >= c) tn++;
                                    else t1 = t1 + T;
                                    T = 0;
                                }
                            }
                        }
                    }
                }
                if(F!=0)
                {
                    if(F>=c) fn++;
                    else f1=f1+F;
                }
                if(T!=0)
                {
                    if(T>=c) tn++;
                    else t1=t1+T;
                }
                MCt=MC + tn*c + t1;
                MCf=MC + fn*c + f1 + c;
                res[p] = Math.Min(MCt, MCf);
               
                p++;
            }
            i = 0;
            while (i < q)
            {
                Console.WriteLine(res[i]);
                i++;
            }
           // Console.ReadLine();


        }
    }
}