private static int maxSum(int[] a){
		int maxSum=0;
		int tempSum=0;
		int max = Integer.MIN_VALUE;
		for(int i=0;i<a.length;i++){
			tempSum+=a[i];
			max = Math.max(max, a[i]);
			if(tempSum>0){
				maxSum+=tempSum;
				tempSum=0;
			}
		}
//		System.out.println(maxSum);
		return maxSum==0?max:maxSum;
	}