SHARE
TWEET

Untitled

a guest Oct 17th, 2019 99 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. ch = []
  3. nch = []
  4.  
  5. for i in range(n):
  6.     a = int(input())
  7.     if a % 2 == 0:
  8.         ch.append(a)
  9.     else:
  10.         nch.append(a)
  11.  
  12. ch.sort()
  13. nch.sort()
  14.  
  15. if len(ch) % 2 == 1:
  16.     ch[0] = 0
  17. if len(nch) % 2 == 1:
  18.     nch[0] = 0
  19.  
  20. if len(ch) == 1 and len(nch) == 1:
  21.     print(-1)
  22. else:
  23.     print(sum(ch) + sum(nch))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top