Imports System.Collections
Imports System.Collections.Generic
Imports System.Linq
Imports System.xml
Imports System.xml.Linq

Module Module1
	private class akasan
		public readonly property ureshisa
			get
				return preUreshisa * math.abs(preX - y)
			end get
		end property
		public y as integer
		public preX as integer
		public preUreshisa as integer
		
	end class
	public sub main()

		dim N as integer = convert.toint32(Console.ReadLine())
		dim A as string() = Console.ReadLine().split(" ")
		dim outputMax as integer = 0
		dim akasanList as new list(of akasan)
		
		for i as integer = 0 to A.count - 1
			dim akasanData as new akasan
			akasanData.preX = i
			akasanData.preUreshisa = convert.toint32(A(i))
			akasanData.y = i
			
			akasanList.add(akasanData)
		next
		
		'途中


		
	  
	end sub 
	

End Module