int input summ -1 if print -1 else for in range append int input for i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
n = int(input())
a = []
summ = -1
c = 0
t = 0
if n < 5:
print(-1)
else:
for i in range(n):
a.append(int(input()))
for i in range(len(a)//2+1):
for j in range(i+4, len(a)):
if i+4 < len(a):
if a[i]+a[j] > summ and (a[i]+a[j])%112 == 0 and a[i]>a[j]:
summ = a[i]+a[j]
c = a[i]
t = a[j]
print(summ)
print(c, t)