Skip to content

Instantly share code, notes, and snippets.

@mhnabi
Created July 6, 2018 12:14
Show Gist options
  • Save mhnabi/9dbdb51af56f7b0b7a9162ff6722be4e to your computer and use it in GitHub Desktop.
Save mhnabi/9dbdb51af56f7b0b7a9162ff6722be4e to your computer and use it in GitHub Desktop.
n = int(input()) # length of list
l = input().split(" ") # Number list
for i in range(n-1):
y = []
if len(l) == 1:
break
for j in range(len(l) - 1):
y.append(int(l[j+1]) - int(l[j])) # subtraction of elements
l = y
print(l[0] % ((10**9)+7)) # remain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment