import java.util.Scanner;

public class Petiiiii {

    public static void main(String[] args) {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int C = sc.nextInt();
        int Q = sc.nextInt();
        String s = sc.next();
        int[]L = new int[Q];
        int[]R = new int[Q];
        for (int i = 0; i < Q; i++) {
            L[i] = sc.nextInt();
            R[i] = sc.nextInt();
        }
        int br = 0;
        for (int i = 0; i < Q; i++) {
            int[] ch = new int[N];
            int z = 0;
            for (int j = 0; j < N; j++) {
                ch[j] = s.charAt(j) - '0';
            }
            for (int j = (L[i]-1); j <= (R[i]-1); j++) {
                if(ch[j] == 0){
                    ch[j] = 1;
                }
                else {
                    ch[j] = 0;
                }
                z+=ch[j];
            }
            
            if( Q <= z){
                br = z;
            }
            
            System.out.println(br);
        }

    }
    
}