count = int(input())
arr = input().split()
s1 = 0
s2 = 0
for i in arr:
  s2 += int(i)
minimum_diff = s2
for i in range(0, count):
  s1 += int(arr[i])
  s2 -= int(arr[i])
  minimum_diff = min(minimum_diff, abs(s1-s2))
  
print(minimum_diff) count = int(input()) count int(input()) int input() input arr = input().split() arr input().split() ().split () input split s1 = 0 s1 0 s2 = 0 s2 0 for i in arr:
  s2 += int(i) i arr s2 += int(i) s2 int(i) int i minimum_diff = s2 minimum_diff s2 for i in range(0, count):
  s1 += int(arr[i])
  s2 -= int(arr[i])
  minimum_diff = min(minimum_diff, abs(s1-s2))
   i range(0, count) range 0 count s1 += int(arr[i]) s1 int(arr[i]) int arr[i] arr i s2 -= int(arr[i]) s2 int(arr[i]) int arr[i] arr i minimum_diff = min(minimum_diff, abs(s1-s2)) minimum_diff min(minimum_diff, abs(s1-s2)) min minimum_diff abs(s1-s2) abs s1-s2 s1 s2 print(minimum_diff) print minimum_diff s2 -= int(arr[i]) int(arr[i]) s2 arr = input().split() input().split() arr s2 = 0 0 s2 minimum_diff = s2 s2 minimum_diff s1 = 0 0 s1 s1 += int(arr[i]) int(arr[i]) s1 s2 += int(i) int(i) s2 minimum_diff = min(minimum_diff, abs(s1-s2)) min(minimum_diff, abs(s1-s2)) minimum_diff count = int(input()) int(input()) count
count = int(input())
arr = input().split()
s1 = 0
s2 = 0
for i in arr:
  s2 += int(i)
minimum_diff = s2
for i in range(0, count):
  s1 += int(arr[i])
  s2 -= int(arr[i])
  minimum_diff = min(minimum_diff, abs(s1-s2))
  
print(minimum_diff)
