Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = int(input())
- ch = []
- nch = []
- for i in range(n):
- a = int(input())
- if a % 2 == 0:
- ch.append(a)
- else:
- nch.append(a)
- ch.sort()
- nch.sort()
- if len(ch) % 2 == 1:
- ch[0] = 0
- if len(nch) % 2 == 1:
- nch[0] = 0
- if len(ch) == 1 and len(nch) == 1:
- print(-1)
- else:
- print(sum(ch) + sum(nch))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement