{"trustable":false,"sections":[{"title":"","value":{"format":"PLAIN","content":"A Communist regime is trying to redistribute wealth in a village. They have have decided to sit everyone around a circular table. First, everyone has converted all of their properties to coins of equal value,such that the total number of coins is divisible by the number of people in the village. Finally, each person gives a number of coins to the person on his right and a number coins to the person on his left,such that in the end, everyone has the same number of coins. Given the number of coins of each person,compute the minimum number of coins that must be transferred using this method so that everyonehas the same number of coins.\n\n一个共产党政权正试图在一个村庄重新分配财富。他们决定让每个人坐在一张圆形的桌子旁。首先,每个人把自己的财产都兑换成等值的硬币,这样,硬币的总数就可以除以村里的人数。最后,每个人给右边的人若干枚硬币,给左边的人若干枚硬币,这样,最后每个人的硬币数量都是一样的。给定每个人的硬币数量,计算用这种方法必须转移的最小硬币数量,使每个人都有相同数量的硬币。\n"}},{"title":"Input","value":{"format":"PLAIN","content":"\n\nThere is a number of inputs. Each input begins with n(n\u003c1000001), the number of people in the village.n lines follow, giving the number of coins of each person in the village, in counterclockwise order around the table. The total number of coins will fit inside an unsigned 64 bit integer.\n\n有一些输入。每个输入以n(n\u003c1000001)开始,即村子里的人数.n行跟随,给出村子里每个人的硬币数量,按逆时针顺序绕着桌子转。总的硬币数将适合在一个无符号的64位整数内。"}},{"title":"Output","value":{"format":"PLAIN","content":"For each input, output the minimum number of coins that must be transferred on a single line.\n\n对于每个输入,输出单行必须传输的最小硬币数。"}},{"title":"Sample Input","value":{"format":"PLAIN","content":"3\n100\n100\n100\n4\n1\n2\n5\n4"}},{"title":"Sample Output","value":{"format":"PLAIN","content":"0\n4"}}]}