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

namespace takmicenjeZadaci
{
    class Program
    {
        static string Izmeni(string s, int l, int r)
        {
            for (int i = l - 1; i < r; i++)
            {
                if (s[i] == '1')
                {
                    StringBuilder sb = new StringBuilder(s);
                    sb[i] = '0';
                    s = sb.ToString();
                }
                else
                {
                    StringBuilder sb = new StringBuilder(s);
                    sb[i] = '1';
                    s = sb.ToString();
                }
            }
            return s;
        }

        static int Cena(string s, int c)
        {
            int cena = 0;
            int count1 = 0;
            int count0 = 0;
            while(s.Contains('1'))
            {
                for(int i = 0; i < s.Length; i++)
                {
                    if (s[i] == '1')
                    {
                        count1++;
                        s.Remove(i);
                    }
                    else
                    {
                        count0++;
                        s.Remove(i);
                        if (s.StartsWith("0"))
                            count0--;
                    }
                    try
                    {
                        if ((count0 == c - 1) && (s[i + 1] == '0'))
                        {
                            cena += count1;
                            continue;
                        }
                        else
                            cena += c;
                    }
                    catch(IndexOutOfRangeException)
                    {
                        break;
                    }
                }
            }
            return cena;
        }

        static void Main(string[] args)
        {
            string[] unosNCQ = Console.ReadLine().Split();
            int n = int.Parse(unosNCQ[0]);
            int c = int.Parse(unosNCQ[1]);
            int q = int.Parse(unosNCQ[2]);

            string s = Console.ReadLine();

            int[] promene = new int[q];

            for (int i = 0; i < q; i++)
            {
                string[] unosLR = Console.ReadLine().Split();
                int l = int.Parse(unosLR[0]);
                int r = int.Parse(unosLR[1]);
                s = Izmeni(s, l, r);
                promene[i] = Cena(s, c);
            }

            foreach (int i in promene)
                Console.WriteLine(i);
        }
    }
}