classMain{ staticint N = 100010; staticlong[] p = newlong[N]; staticlong[] h = newlong[N]; staticint b=131; staticlong mod = Long.MAX_VALUE; //关键 staticvoidinit(String s){ p[0]=1; char[] arr = s.toCharArray(); for(int i=1;i<arr.length;i++){ h[i] = (h[i-1]*b+arr[i-1])%mod; p[i] = p[i-1] * b; } } staticlongquery(int l, int r){ return h[r] - h[l-1] * p[r-l+1]; } publicstaticvoidmain(String[] args)throws IOException{ BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String[] cur = in.readLine().split(" "); int n=Integer.parseInt(cur[0]); int m=Integer.parseInt(cur[1]);
String s = in.readLine(); init(s); while(m-->0){ String[] arr=in.readLine().split(" "); int l1 = Integer.parseInt(arr[0]); int r1 = Integer.parseInt(arr[1]); int l2 = Integer.parseInt(arr[2]); int r2 = Integer.parseInt(arr[3]);