import java.io.*; import java.util.*; import java.util.stream.Collector; public class kadane { public static void main(String args[]) throws NumberFormatException, IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int[] input = Arrays.stream(reader.readLine().split(" ")).mapToInt(x -> Integer.parseInt(x)).toArray(); int maxSum = Integer.MIN_VALUE; int sum = 0; int startIndex = 0; int endIndex = 0; int maxStart = 0; int maxEnd = 0; for (int i = 0; i < input.length; i++) { if (sum < 0) { startIndex = i; endIndex = i; sum = 0; } sum += input[i]; endIndex = i; if (sum > maxSum) { maxStart = startIndex; maxEnd = endIndex; maxSum = sum; } else if (sum == maxSum && ((endIndex - startIndex) > (maxEnd - maxStart))) { maxStart = startIndex; maxEnd = endIndex; } } System.out.println(String.format("%d %d %d", maxSum, maxStart, maxEnd)); } }