我这样写不超时但是会出Runting Error
import java.util.*;
import java.math.*;
public class Main {
public static void main(String args[]){
Scanner in = new Scanner(System.in);
Scanner sc = new Scanner(System.in);
int n = in.nextInt();
String str = sc.nextLine();
for(int i = 0; i < n; i++){
int a = in.nextInt();
int b = in.nextInt();
String s = str.substring(a-1, b);
char c[] = s.toCharArray();
long sum = 1;
for(int j = 0; j < c.length; j++){
sum = sum * (((int)c[j])-28) % 9973;
}
System.out.print(sum);
}
}
}