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

namespace petilja_1feladat
{
    class Program
    {
        static void Main(string[] args)
        {
            string asd = Console.ReadLine();
            string[] asdT = asd.Split(' ');
            int N = Convert.ToInt32(asdT[0]);
            int C = Convert.ToInt32(asdT[1]);//adott sor megforditasanak koltsege
            int Q = Convert.ToInt32(asdT[2]);

            string S = Console.ReadLine();

            int[] Ltomb = new int[Q];
            int[] Rtomb = new int[Q];
            
            for (int i = 0; i < Q; i++)
            {
                asd = Console.ReadLine();
                string[] asdT2 = asd.Split(' ');
                Ltomb[i] = Convert.ToInt32(asdT2[0]);
                Rtomb[i] = Convert.ToInt32(asdT2[1]);
            }

            for (int i = 0; i < Q; i++)
            {
                int penz1fordit = 0;
                int penz0fordit = 1;
                string S2 = null;
                for(int j = 0; j < N; j++)
                {
                    if(j>=Ltomb[i]-1 && j <= Rtomb[i]-1)
                    {
                        
                        if(S[j] == '0')
                        {
                            S2 += '1';
                        }
                        else
                        {
                            S2 += '0';
                        }
                    }
                    else
                    {
                        S2 += S[j];
                    }
                }//alap valtoztatas megcsinalasa
                S = S2;
                //Console.WriteLine("S: " + S);
                string[] tomb0 = S2.Split('1');
                string[] tomb1 = S2.Split('0');
                for (int j = 0; j < tomb0.Length; j++)
                {
                    if (tomb0[j] != "")
                    {
                        penz0fordit++;
                        //Console.WriteLine("0 --> " + tomb0[j]);
                    }
                }
                for (int j = 0; j < tomb1.Length; j++)
                {
                    if (tomb1[j] != "")
                    {
                        penz1fordit++;
                        //Console.WriteLine("1 --> " + tomb1[j]);
                    }
                }
                if (penz0fordit > penz1fordit)
                {
                    Console.WriteLine(penz1fordit);
                }
                else
                {
                    Console.WriteLine(penz0fordit);
                }
            }




        }

    }
}