Company: Tesco_15nov
Difficulty: medium
Maximum BLOCKSUM Problem Description N blocks are arranged in a row, with each block having a number written on top of it. The blocks can be re-arranged only in one way by shifting the first block to the last position, and all other blocks would shift one position to the left i.e. block 1 becomes block N, block 2 becomes block 1, block 3 becomes block 2, and so on. This re-arrangement can be done any number of times. For a given position of the blocks, the BLOCKSUM is defined as: Σi * Pi Where i is the index of the block starting at 1 i.e. 1 <= i <= N, and Pi is the value of the block at index i. Write a program to determine the maximum BLOCKSUM possible for the given blocks by rearranging the blocks as many times as needed in the specified way. You must read the input from STDIN (standard input) and write the output to STDOUT (standard output). Do not print arbitrary strings any where in the program, as those would contribute to output and test cases will fail. Constraints 1 <= N <= 1