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

namespace ConsoleApplication71
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int c = int.Parse(s[1]);
            int q = int.Parse(s[2]);
            int b0 = 0;
            long s1 = long.Parse(Console.ReadLine());
            double[] a = new double[n];
            double stepen = Math.Pow(10, n-1);
            for (int i = 0; i < n; i++)
            {
                a[i] = (s1 / stepen) % 10;
                if (a[i] == 0) b0++;
                stepen/=10;
            }
            if(c==n)
            {
                for(int i = 0; i<q; i++)
                {
                    s = Console.ReadLine().Split();
                    int l = int.Parse(s[0]);
                    int d = int.Parse(s[1]);
                    for(int j = l; j<=d;j++)
                    {
                        a[j] = (a[j] + 1) % 2;
                        if (a[j] == 1) b0--;
                        else b0++;
                    }
                    Console.WriteLine(b0);
                }
            }
        }
    }
}