Harryxun/stf_run huggingface dataset:
# Vol0004.
import sys

def main():
    data = []
    lines = sys.stdin.readlines()
    for line in lines:
        data.append(line.split())  # スペース区切りで放り込む
    # ax + by = c, dx + ey = fの解は、
    # x = (ce - bf) / (ae - bd), y = (af - cd) / (ae - bd).
    # これをround(float, 3)すれば答えが出る。
    N = len(data)
    for i in range(N):
        det = data[i][0] * data[i][4] - data[i][1] * data[i][3]
        gx = data[i][2] * data[i][4] - data[i][1] * data[i][5]
        gy = data[i][0] * data[i][5] - data[i][2] * data[i][3]
        print(str(round(gx / det, 3)) + " " + str(round(gy / det, 3)))

if __name__ == "__main__":
    main()


### FIXED CODE ###

# Vol0004.
import sys

def main():
    data = []
    lines = sys.stdin.readlines()

    for line in lines:
        data.append(line.split())  # スペース区切りで放り込む
    # ax + by = c, dx + ey = fの解は、
    # x = (ce - bf) / (ae - bd), y = (af - cd) / (ae - bd).
    # これをround(float, 3)すれば答えが出る。
    N = len(data)
    for i in range(N):
        for k in range(6):
            data[i][k] = int(data[i][k])
        det = data[i][0] * data[i][4] - data[i][1] * data[i][3]
        gx = data[i][2] * data[i][4] - data[i][1] * data[i][5]
        gy = data[i][0] * data[i][5] - data[i][2] * data[i][3]
        if det < 0:
            det = -det;
            if gx != 0: gx = -gx
            if gy != 0: gy = -gy
        print("{0:.3f}".format(gx / det) + " " + "{0:.3f}".format(gy / det))

if __name__ == "__main__":
    main()

# 補足、0.1とか0.22でも3桁目まで表示しないとWrongになる。
# 表示するにはprint("{0:.nf}".format(数))ってやる(nのところは桁数)。
# さらに、0を負の数で割ると表示が-0.000になってしまうのでそこの処理も重要。
n = int(input())
for i in range(n):
  ans += (i+1)
print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for i in range(n):
  ans += (i+1)
print(ans)
n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ansn[i][0]*10**(n-i-1)
print(ansn)
        
        

### FIXED CODE ###

n,m=map(int,input().split())
s=[]
c=[]
for i in range(m):
    st,ct=map(int,input().split())
    s.append(st)
    c.append(ct)
ans=[[0,0] for i in range(n)]
for i in range(m):
    if s[i]==1 and c[i]==0 and n>=2:
        print(-1)
        exit()
    if ans[s[i]-1][1]==0:
        ans[s[i]-1][0]=c[i]
        ans[s[i]-1][1]=1
    else:
        if ans[s[i]-1][0] != c[i]:
            print(-1)
            exit()
if ans[0][0]==0 and n>=2:
    ans[0][0]=1
ansn=0
for i in range(n):
    ansn+=ans[i][0]*10**(n-i-1)
print(ansn)
a,b,h=map(int, input().split());print((a+b)*h//2)

### FIXED CODE ###

a,b,h=[int(input()) for i in range(3)];print((a+b)*h//2)
while True:
   m, f, r = [int(i) for i in input().split()]
 
   if m == f == r == -1:
      break
   elif m or f == -1:
      return F
   
   elif m + f >= 80:
      return A
   elif 65 <= m +f < 80:
      return B
   elif 50 <= m+f < 65:
      return C
   elif 30 <= m+f < 50:
      if r >= 50:
        return C
      else:
        return D
   else:
      return F

### FIXED CODE ###

while True:
   m, f, r = [int(i) for i in input().split()]
 
   if m == f == r == -1:
      break
   total = m + f
   if m == -1 or f == -1 or total < 30:
      print("F")
   
   elif total < 50 and r < 50:
      print("D")

   elif r >= 50 or total < 65:
      print("C")
   
   elif total < 80:
      print("B")

   else:
      print("A")
n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]

E = [[] for i in range(n+1)]

for a, b in X:
    E[a].append(b)

memo = [-1] * (n+1)

def dfs(i):
    if memo[i] != -1:
        return memo[i] + 1
    if not E[i]:
        return 0

    memo[i] = max(dfs(e) for e in E[i])
    return memo[i] + 1

print(max(dfs(i) for i in range(1, n+1)))

### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10 ** 9)

n, m = [int(i) for i in input().split()]
X = [[int(i) for i in input().split()] for j in range(m)]

E = [[] for i in range(n+1)]

for a, b in X:
    E[a].append(b)

memo = [-1] * (n+1)

def dfs(i):
    if memo[i] != -1:
        return memo[i] + 1
    if not E[i]:
        return 0

    memo[i] = max(dfs(e) for e in E[i])
    return memo[i] + 1

print(max(dfs(i) for i in range(1, n+1)))
n = int(input())
A = list(map(int,input().split()))

counter = 0
end_judge = 0
while 1:
  
  for i in range(n):
    if A[i]%2 == 1:
      end_judge = 1
    else:
      A[i] = A[i] / 2    
  if end_judge == 1:
    break    
  counter += 1
  
print(counter)

### FIXED CODE ###

li = list(input())
count = 0
for i in range(3):
  if li[i] == '1':
    count += 1
print(count)
import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.sqrt(m))
	if m%i==0:
		s.append(i)



for i in s
	if m%(i+1)==0 and m//(i+1)>n-1:
		x=max(x,i+1)
print(x)





### FIXED CODE ###

import math

n,m = map(int,input().split())

x=0

s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		s.append(i+1)
		s.append(m//(i+1))




for i in s:
	if m%(i)==0 and m//(i)>n-1:
		x=max(x,i)
print(x)
if (__name__ == '__main__'):
    a = [0]
    b = [0]
    c = [0]

    aa = input().strip().split()
    for i in range(n):
        a.append(int(aa[i]))
    bb = input().strip().split()
    for i in range(n):
        b.append(int(bb[i]))
    cc = input().strip().split()
    for i in range(n-1):
        c.append(int(cc[i]))

    sum = b[a[1]]
    lastmenu = a[1]

    for i in range(2, n+1):
        sum = sum + b[a[i]]
        if (a[i] == lastmenu+1):
            sum = sum + c[lastmenu]
        lastmenu = a[i]

    print(sum)


### FIXED CODE ###

if (__name__ == '__main__'):
    n = int(input())
    
    a = [0]
    b = [0]
    c = [0]

    aa = input().strip().split()
    for i in range(n):
        a.append(int(aa[i]))
    bb = input().strip().split()
    for i in range(n):
        b.append(int(bb[i]))
    cc = input().strip().split()
    for i in range(n-1):
        c.append(int(cc[i]))

    sum = b[a[1]]
    lastmenu = a[1]

    for i in range(2, n+1):
        sum = sum + b[a[i]]
        if (a[i] == lastmenu+1):
            sum = sum + c[lastmenu]
        lastmenu = a[i]

    print(sum)
N=int(input())
if N[0]==7 or N[1]==7 or N[2]==7:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

N = list(str(input()))
if int(N[0]) == 7 or int(N[1]) == 7 or int(N[2]) == 7:
  print('Yes')
else:
  print('No')
n = int(input())
a = [int(k) for k in input().split()]
import math
ans = math.gcd(a[0],a[1])
for i in a[2:]:
	ans = math.gcd(ans,i)
print(ans)

### FIXED CODE ###

n = int(input())
a = [int(k) for k in input().split()]

def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x
ans = gcd(a[0],a[1])
for i in a[2:]:
	ans = gcd(ans,i)
print(ans)
s=list(list(i for i in input()).sort())
t=list(list(i for i in input()).sort()(reverse=True))
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')


### FIXED CODE ###

s=sorted(input())
t=sorted(input())[::-1]
A=True
for i in range(min(len(s),len(t))):
    if s[i]<t[i]:
        A = True
        break
    elif s[i]>t[i]:
        A = False
        break
    else:
        if len(s)<len(t): A=True
        else:A= False
print('Yes' if A else 'No')
# -*- coding: utf-8 -*-
def main():
    n, q = inputAsIntArr()
    s = input()

    # 予め探す
    idxes = []
    for i in range(n):
        if s[i] != 'A':
            continue
        if s[i+1] == 'C':
            idxes.append(i)
            i += 1

    # 指定された箇所に何件含まれるか
    num_acs = ""
    for i in range(q):
        li, ri = inputAsIntArr()
        num_ac = len([v for v in idxes if li-2 < v < ri-1])
        num_acs += "{}\n".format(str(num_ac))

    print(num_acs)


def inputAsIntArr():
    return [int(i) for i in input().split(' ')]


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n, q = map(int, input().split())
    s = input()

    # 累積出現数を格納: 指定される番号が1始まりなのでズラして格納
    p = [0] * (n+1)
    for i in range(n):
        p[i+1] = p[i] + (1 if s[i:i+2] == "AC" else 0)

    for i in range(q):
        l, r = map(int, input().split())
        # 終端(=l-1)から始端-1(=r-1)の累積出現数を引いた数が指定区間内での出現回数
        print(p[r-1] - p[l-1])


if __name__ == '__main__':
    main()
N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

#(2**i)÷popcountを保存するリストを作成
f_tp = [0] * N  
f_tm = [0] * N  

for i in range(0,N):
  f_tp[i] = (2**(N-1-i)) % (pop_c + 1) 
  f_tm[i] = (2**(N-1-i)) % (pop_c - 1) 

  
for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + f_tp[i]) % (pop_c + 1) 
    Ans = 1
    
  elif strX[i] == '1' and pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - f_tm[i]
    if pop_a < 0:
      pop_a = pop_a + pop_c + 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)


### FIXED CODE ###

N = int(input())
strX = input()

#10進数に変換
decX = int(strX,2)

#1の数をカウント
pop_c = strX.count('1')

# X % popcount+1
f_p = decX % (pop_c + 1)

# X % popcount-1(0になる時は0)
if pop_c == 1:
  f_m = 0
else:
  f_m = decX % (pop_c - 1)

for i in range(0,N):
  if strX[i] == '0':
    pop_a = (f_p + pow(2,(N-1-i),(pop_c + 1))) % (pop_c + 1) 
    Ans = 1
    
  elif pop_c == 1:
    pop_a = 0
    Ans = 0
    
  else:
    pop_a = f_m - (pow(2,(N-1-i),(pop_c - 1)))
    if pop_a < 0:
      pop_a = pop_a + pop_c - 1
    Ans = 1
  
  while pop_a > 0:
    wkpop = bin(pop_a).count('1')
    pop_a = pop_a % wkpop
    Ans += 1
  
  print(Ans)
a = int(input())
b = int(input())
c = int(input())
 
 
 
if a == 5 and b == 5 and c == 7:
    print("YES")
 
elif a == 5 and b == 7 and c == 5:
    print("YES")
 
elif a == 7 and b == 5 and c == 5:
    print("YES")
 
 
    
else:
    print("NO")

### FIXED CODE ###

a=input().split()
if a.count('5')==2 and a.count('7')==1:
    print('YES')
else:
    print('NO')
A, B, T = int(input().split())

i = int((T + 0.5) // A)

print(int(B * i))



### FIXED CODE ###

A, B, T = map(int, input().split())

i = int((T + 0.5) // A)

print(int(B * i))
N = int(input())
a = int(input())
b = int(input())
if N == 1:
    print("Hello World")
else:
    print(a+b)

### FIXED CODE ###

N = int(input())
if N == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
N = int(input())
a = sorted(list(map((int, input().split())), reverse=True))
A = 0
B = 0
for i in range(N):
    if i % 2 == 0:
        A += a[i]
    else:
        B += a[i]

print(A - B)


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
asort = sorted(a, reverse=True)
A = 0
B = 0
for i in range(N):
    if i % 2 == 0:
        A += asort[i]
    else:
        B += asort[i]

print(A - B)
(a, b, c) = [int(i) for i in input().rstrip().split()]

count = 0
for x in range(a, b + 1):
 if c % x == 0:
  count++
print(count)

### FIXED CODE ###

(a, b, c) = [int(i) for i in input().split()]

count = 0
for x in range(a, b + 1):
 if c % x == 0:
  count += 1

print(count)
import math
import time

t = time.time()
def iip():
    return [int(i) for i in input().split()]

H, N = iip()
mp_for_damage = [10**9 for i in range(H+1)]
mp_for_damage[0] = 0

for i in range(N):
    a, b = iip()
    for j in range(H+1):
        if mp_for_damage[a] < b:
            continue

        for k in range(1, a):
            if k > H:
                break
            mp_for_damage[k] = min(mp_for_damage[k], b)

        if j + a > H:
            break
        mp_for_damage[j+a] = min(mp_for_damage[j+a], mp_for_damage[j] + b)

#print(mp_for_damage)
print(mp_for_damage[H])

#print(time.time() - t)

### FIXED CODE ###

import math
import time


t = time.time()
def iip():
    return [int(i) for i in input().split()]

def main():
    H, N = iip()
    mp_for_damage = [10**9 for i in range(H+1)]
    mp_for_damage[0] = 0
    ab = []

    for i in range(N):
        ab.append(iip())

    ab= sorted(ab, key=lambda x:x[0]/x[1], reverse=True)

    for i in range(N):
        a, b = ab[i]

        for k in range(1, min(a, H) + 1):
            mp_for_damage[k] = min(mp_for_damage[k], b)
            # print(k, b)

        if a >= H:
            mp_for_damage[H] = min(mp_for_damage[H], b)
            continue

        if a < H and mp_for_damage[a] < b:
            continue

        for j in range(H-a+1):
            mp_for_damage[j+a] = min(mp_for_damage[j+a], mp_for_damage[j] + b)

    #print(mp_for_damage)
    #print(mp_for_damage)
    print(mp_for_damage[H])

    #print(time.time() - t)

main()
import math
N = int(input())
num = 0
i = 1
while i <= math.sqrt(N):
    if N % i == 0:
        a = i - 1
        b = (N // i) - 1
        if a == b:
            if N // a == N % a:
                num += a
        else:
            if a > 0 and N // a == N % a:
                num += a
            if b > 0 and N // b == N % b:
                num += b
    i += 1

print(num)

### FIXED CODE ###

import math
N = int(input())
num = 0
i = 1
while i <= math.sqrt(N):
    if N % i == 0:
        a = i - 1
        b = (N // i) - 1
        if a == b:
            if a > 0 and N // a == N % a:
                num += a
        else:
            if a > 0 and N // a == N % a:
                num += a
            if b > 0 and N // b == N % b:
                num += b
    i += 1

print(num)
a, b, c = input().split(sep = ", ")
if(len(a) == 7):
    print(b.lower() + " " + a.lower() + " " + c.lower())
elif(len(b) == 7):
    print(a.lower() + " " + b.lower()  + " " + c.lower())
elif(len(c) == 7):
    print(a.lower() + " " + c.lower() + " " + b.lower*(()


### FIXED CODE ###

a, b, c = input().split(sep = ",")
 
print(a, b, c)
A, B = map(int,input().split())

if A<9 AND B<9:
	print('Yay!')
else:
	print(':(')

### FIXED CODE ###

A, B = map(int,input().split())

if A<9 and B<9:
	print('Yay!')
else:
	print(':(')
while True:
    a,b=map(int,input().split())
    if (a*b)%2 == 0:
        print('Even')

    else:
        print('Odd')


### FIXED CODE ###

a,b=map(int,input().split())
if (a*b)%2 == 0:
    print('Even')

else:
    print('Odd')
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8

import math
import re
import sys
 
args = sys.argv

X = args[0]
Y = args[1]
Z = args[2]

# 人数
a = (X-Z)/(Y+Z)

print(int(a))



### FIXED CODE ###

#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
 
import math
import re
import sys
 
args = input().split()

X = args[0]
Y = args[1]
Z = args[2]
 
# 人数
a = (int(X)-int(Z))/(int(Y)+int(Z))
 
print(int(a))
import sys
input = sys.stdin.readline

N = int(input())
VW = [[int(x)-1 for x in input().split()] for _ in range(N-1)]

"""
直径に次数1の頂点が生えている
"""

graph = [[] for _ in range(N)]
deg = [0] * N
for v,w in VW:
    graph[v].append(w)
    graph[w].append(v)
    deg[v] += 1
    deg[w] += 1

def dijkstra(start):
    INF = 10**10
    dist = [INF] * N
    q = [(start,0)]
    while q:
        qq = []
        for v,d in q:
            dist[v] = d
            for w in graph[v]:
                if dist[w] == INF:
                    qq.append((w,d+1))
        q = qq
    return dist

dist = dijkstra(0)
v = dist.index(max(dist))
dist = dijkstra(v)
w = dist.index(max(dist))
diag = v,w

def create_perm(v,parent,next_p,arr):
    next_v = None
    V1 = []
    V2 = []
    for w in graph[v]:
        if w == parent:
            continue
        if deg[w] == 1:
            V1.append(w)
        else:
            V2.append(w)
    if len(V2) > 0:
        next_v = V2[0]
    else:
        if len(V1) == 0:
            arr.append(next_p)
            return
        next_v = V1[-1]
        V1 = V1[:-1]
    arr += list(range(next_p+1,next_p+len(V1)+1))
    arr.append(next_p)
    next_p += len(V1)+1
    create_perm(next_v,v,next_p,arr)

P = []
create_perm(diag[1],None,1,P)

Q = []
create_perm(diag[0],None,1,Q)

if len(P) != N:
    answer = -1
else:
    if P > Q:
        P = Q
    answer = ' '.join(map(str,P))
print(answer)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

N = int(input())
VW = [[int(x)-1 for x in input().split()] for _ in range(N-1)]

"""
直径に次数1の頂点が生えている
"""

graph = [[] for _ in range(N)]
deg = [0] * N
for v,w in VW:
    graph[v].append(w)
    graph[w].append(v)
    deg[v] += 1
    deg[w] += 1

def dijkstra(start):
    INF = 10**10
    dist = [INF] * N
    q = [(start,0)]
    while q:
        qq = []
        for v,d in q:
            dist[v] = d
            for w in graph[v]:
                if dist[w] == INF:
                    qq.append((w,d+1))
        q = qq
    return dist

dist = dijkstra(0)
v = dist.index(max(dist))
dist = dijkstra(v)
w = dist.index(max(dist))
diag = v,w

def create_perm(start):
    arr = []
    v = start
    parent = None
    next_p = 1
    while True:
        n = 0
        next_v = None
        for w in graph[v]:
            if w == parent:
                continue
            if next_v is None or deg[next_v] < deg[w]:
                next_v = w
            if deg[w] == 1:
                n += 1
        if next_v is None:
            return arr + [next_p]
        if deg[next_v] == 1:
            n -= 1
        arr += list(range(next_p+1,next_p+n+1))
        arr.append(next_p)
        next_p += n+1
        parent = v
        v = next_v

P = create_perm(diag[1])

Q = create_perm(diag[0])

if len(P) != N:
    answer = -1
else:
    if P > Q:
        P = Q
    answer = ' '.join(map(str,P))
print(answer)
def res(n):
    pos = n
    cnt = 1
    while 1:
        pos = P[pos]-1
        if pos == n:
            break
        cnt += 1

    tmp = 0
    pos = n
    ans = []

    for _ in range(min(K,cnt)):
        pos = P[pos]-1
        tmp += C[pos]
        ans.append(tmp)
    
    pos =
    ##ループして0以上なら(K//cnt)回ループしてあまりをシミュレーション
    if tmp > 0:
        d = K%cnt
        tmp = (K//cnt)*tmp
        ans.append(tmp)
        for _ in range(d):
            pos = P[pos]-1
            tmp += C[pos]
            ans.append(tmp)

    return max(ans)

            
N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = -1e20
for i in range(N):
    ans = max(ans,res(i))

print(ans)


### FIXED CODE ###

def res(n):
    pos = n
    cnt = 1
    while 1:
        pos = P[pos]-1
        if pos == n:
            break
        cnt += 1

    tmp = 0
    ans = -float("inf")
    pos = n

    for _ in range(min(K,cnt)):
        pos = P[pos]-1
        tmp += C[pos]
        ans = max(ans,tmp)
    
    ##ループして0以上なら(K//cnt)回ループしてあまりをシミュレーション
    if tmp > 0 and K > cnt:
        pos = n
        d = K%cnt
        tmp = (K//cnt-1)*tmp
        ans = max(ans,tmp)
        for _ in range(d+cnt):
            pos = P[pos]-1
            tmp += C[pos]
            ans = max(ans,tmp)

    return ans

N,K = map(int,input().split())
P = list(map(int,input().split()))
C = list(map(int,input().split()))

ans = -float("inf")
for i in range(N):
    ans = max(ans,res(i))

print(ans)
n=int(input())
x=list(input().split(), for i in range(n))
ans=0
for j in range(n):
  if x[j][1]=="JPY":
    ans+=x[j][0]
  else:
    ans+=x[j][0]*380000
print(ans)    
  


### FIXED CODE ###

n=int(input())
x=list(input().split() for _ in range(n))
ans=0
for i in range(n):
  if str(x[i][1])=="JPY":
    ans+=float(x[i][0])
  else:
    ans+=float(x[i][0])*380000
    
print(ans)
N = int(input())
X = []
for i in range(N):
	s, p = input()
	X.append([s, p,  i+1])
X.sort()
s = X[0][0]
for i in range(N):
	j = i
	while True:
		if j == len(X) - 1:
			break
		if X[j][0] != s:
			j -= 1
			break
	for k in range(j-i+1):
		print(X[j][2])
		j -= 1

### FIXED CODE ###

N = int(input())
X = []
for i in range(N):
	s, p = input().split()
	X.append([s, -int(p),  i+1])
X.sort()
for i in range(N):
	print(X[i][2])
while True:
     k = input()
     if 1 <= int(k) <= 100:
         break;
     print ('Error Invalid Input for K')


while True:
     s = input().lower()
     if 1 <= len(s) <= 100:
         break;
     print ('Error Invalid Input for s')


if len(s) > k:
    print(s[:k] + "...")
else:
    print(s)

### FIXED CODE ###

num=int(input()) #ask integer for limitation
s=input() #ask string
if len(s) > num:    #check if the length s exceeded num
    print(s[:num] + "...")  #print s with the limit "num"
else:   #if the string not exceeded num
    print(s)
a = input("Enter number of a:")
b = input("Enter number of b:")
c = input("Enter number of c:")
if(int(a+b+c)>=int(22)):
    print("bust")
else:
    print("win")


### FIXED CODE ###

a = [int(x) for x in input().split(" ")]
print("bust") if sum(a)>=22 else print("win")
import math

n = int(input())
x = [0] + list(map(int, input().split()))
mod = 10**9 + 7

f = [1] * (n+1)
for i in range(1,n+1):
    f[i] = f[i-1] * i % mod

s = [0] + [pow(i, mod-2, mod) for i in range(1,n+1)]
for i in range(n):
    s[i+1] = (s[i+1] + s[i]) % mod

ans = 0.0
for i in range(1,n):
    ans += ((x[i+1] - x[i]) * s[i]) % mod
ans = int(ans * math.factorial(n-1)) % mod
print(ans)

### FIXED CODE ###

import math

n = int(input())
x = [0] + list(map(int, input().split()))
mod = 10**9 + 7

s = [pow(i, mod-2, mod) for i in range(0,n+1)]
for i in range(n):
    s[i+1] = (s[i+1] + s[i]) % mod

ans = 0
for i in range(1,n):
    ans += ((x[i+1] - x[i]) * s[i]) % mod
ans = int(ans * math.factorial(n-1)) % mod
print(ans)