Guest User

Untitled

a guest
Jun 15th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. N=int(input())
  2. a=[0,0,0,0]
  3. res=0
  4. for i in range(4):
  5. a[i] = int(input())
  6. for i in range(N-4):
  7. k=int(input())
  8. for j in range(i%4+1):
  9. if res==0:
  10. res=k+a[j]
  11. else:
  12. res=min(res,k+a[j])
  13. if k<a[i%4]:
  14. a[i%4]=k
  15. print(res)
Advertisement
Add Comment
Please, Sign In to add comment