For this Question: Given an integer S represented as a string, the task is to get the sum of all possible sub-strings of this string.The only line of input contains a single integers S represented as a string.

1 <= len(S) <= 1000000Print the required sum modulo (10^9 + 7)Sample Input 1:
1234

Sample Output 1:
1670

Explanation:
Sum = 1 + 2 + 3 + 4 + 12 + 23 + 34 + 123 + 234 + 1234
 = 1670

Sample Input 2:
421

Sample Output 2:
491

Explanation:
Sum = 4 + 2 + 1 + 42 + 21 + 421
 = 491, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	static int toDigit(char ch)
	{
		return (ch - '0');
	}
	public static void main (String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String s = br.readLine();
		int n = s.length();
		long prev = toDigit(s.charAt(0));
		long res = prev;
		long current = 0L;
		for (int i = 1; i < n; i++){
			long numi = toDigit(s.charAt(i));
			current = ((i + 1) * numi + 10 * prev)%1000000007;
			res =(res+current)%1000000007;
			prev = current;
		}
		System.out.print(res);
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?