Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N=int(input())
- a=[0,0,0,0]
- res=0
- for i in range(4):
- a[i] = int(input())
- for i in range(N-4):
- k=int(input())
- for j in range(i%4+1):
- if res==0:
- res=k+a[j]
- else:
- res=min(res,k+a[j])
- if k<a[i%4]:
- a[i%4]=k
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment