using System;

namespace takmicenje_zad_resi
{
    class Program
    {
        static int b (int[] a, int c, int r)
        {
            bool p = true;
            foreach (int a1 in a) if (a1 == 1) p = false;
            if (p) return r;

        }
        static void Main(string[] args)
        {
            string[] s1 = Console.ReadLine().Split();
            int n = int.Parse(s1[0]);
            int c = int.Parse(s1[1]);
            int q = int.Parse(s1[2]);
            string[] s = Console.ReadLine().Split("");
            int[] a = new int[n];
            {
                int i = 0;
                foreach (string s2 in s) { a[i] = int.Parse(s[i]); i++; }
            }
            for(int i =  0; i < q; i++)
            {
                s1 = Console.ReadLine().Split();
                int l = int.Parse(Console.ReadLine());
                int d = int.Parse(Console.ReadLine());
                for (int i1 = l - 1; i1 < d; i1++) if (a[i1] == 0) a[i1] = 1; else a[i1] = 0;
                Console.WriteLine("2");
            }
            
        }
    }
}