/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ import java.math.BigInteger; import java.util.Scanner; import java.lang.Math; import static java.lang.Math.pow; public class Solution { static int fac(int n){ int r=0; for(int i=0;i<=n;i++){ r=r+i; } return r; } static int max(int[] A,int i , int j) { int t=0; for(int h=i;h<=j;h++){ if(A[h]>t){ t=A[h]; } } return t; // Return the sum of S(S(A)) modulo 10^9+7. } static int suma(int[] A) { int c=0; for(int k=0;k