Harryxun/stf_run huggingface dataset:
import fractions


def func(l):
    r = fractions.gcd(l[0], l[1])
    for i in range(1, len(l) - 1):
        r = fractions.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()


### FIXED CODE ###

import fractions


def func(l):
    r = fractions.gcd(l[0], l[1])    
    for i in range(1, len(l) - 1):
        r = fractions.gcd(r, l[i + 1])
    return r


def main():
    n, x = map(int, input().split())
    xl = [int(i) for i in input().split()]
    xl.append(x)
    xl.sort()
    
    if n == 1:
      print(abs(xl[1] - xl[0]))
      return
    
    dl = []
    for i in range(len(xl) - 1):
        d = xl[i + 1] - xl[i]
        dl.append(d)

    print(func(dl))


if __name__ == '__main__':
    main()
a=input()
if a[0]='7':
	print('Yes')
elif a[1]='7'
	print('Yes')
elif a[2]='7'
	print('Yes')
else:
  print('No')

### FIXED CODE ###

a=input()
ans='No'
for i in a:
  if i=='7':
    ans='Yes'
    break
print(ans)
a,b=map(int,raw_input().split())

if a>b:
 print(a-1)
else:
 print(a)

### FIXED CODE ###

a,b=map(int ,input().split())

if a<=b:
    print(a)
else:
    print(a-1)
S,A,B=map(int,input().split())
print((S//(A+B))*A+min(A,S%(A+B)))

### FIXED CODE ###

S=input()
if("AAA"==S or S=="BBB"):
  print("No")
else:
  print("Yes")
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
a,b,c,d=map(int,input().split())
mod=998244353


dp=[[0]*3005 for _ in range(3005)]
for i in range(a+1):
    for j in range(b+1):
        dp[i][j]=1
#print(dp)

for i in range(3003-b):
    dp[a][b+i+1]=((dp[a][b+i])*a)%mod
for j in range(3003-a):
    dp[a+1+j][b]=((dp[a+j][b]*b))%mod

j=0
for i in range(a,3003-a):
    dp[a+j][b+i+1]=((dp[a+j][b+i])*(a+j)%mod)
    for j in range(b,3003-b):
        dp[a+1+j][b+i]=((dp[a+j][b+i]*(b+i))%mod)
        #dp[i+1][j+1]=(dp[i][j+1]*(j+1))%mod+(dp[i+1][j]*(i+1))%mod-(i*j)

#print(dp[1][1])
print(dp[c][d]%mod)


### FIXED CODE ###

import sys
x=int(input())
x=min(x,360-x)

for i in range(1,361):
    if (i*x)%360==0:
        print(i)
        sys.exit()
N,M = map(int,input().split())
L = list(map(int,input().split()))
if N >= M :
    ans = 0
else :
    L = sorted(L)
    A = []
    for i in range(M-1) :
        A.append(L[i+1]-L[i])
A = sorted(A)
ans = A[:M-N]
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
L = list(map(int,input().split()))
if N >= M :
    ans = 0
else :
    L = sorted(L)
    A = []
    for i in range(M-1) :
        A.append(L[i+1]-L[i])
    A = sorted(A)
    ans = sum(A[:M-N])
print(ans)
x = input()
print(x^1)

### FIXED CODE ###

x = int(input())
print(x^1)
dict = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = map(int,input().split())

if dict[x] > dict[y]:
  print('>')
elif dict[x] == dict[y]:
  print('=')
else:
  print('<')

### FIXED CODE ###

dict = {'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
x,y = map(str,input().split())

if dict[x] > dict[y]:
  print('>')
elif dict[x] == dict[y]:
  print('=')
else:
  print('<')
#!/usr/bin/env python3

import sys
import math
import itertools


def main():
    N, T = map(int, sys.stdin.readline().split())
    As, Bs = map(list, zip(*(tuple(map(int, sys.stdin.readline().split())) for _ in range(N))))

    # dp[i + 1][t] := i番目までの店のうち時間 t を超えないように訪問できる店の数
    # dp[i + 1][t] | int((t - Bs[i]) / As[i]) - 1 >= 0 = max(dp[i][int((t - Bs[i]) / As[i]) - 1] + 1, dp[i][t])
    #              | otherwise                         = dp[i][t]

    memo = {}

    def dp(i, t):
        assert i >= 0
        assert t >= 0

        if i == 0:
            return 0

        if (i, t) in memo:
            return memo[i, t]

        h = i - 1

        tpre = int((t - Bs[h]) / (As[h] + 1)) - 1
        if tpre >= 0:
            x = memo[i, t] = max(dp(h, tpre) + 1, dp(h, t))
            return x
        else:
            x = memo[i, t] = dp(h, t)
            return dp(h, t)

    print(dp(N, T))
    #print(memo)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env pypy3

import sys
import math
import itertools
import bisect

INF = int(1e18)
T_MAX = int(1e9)

def main():
    N, T = map(int, sys.stdin.readline().split())
    shops = [tuple(map(int, sys.stdin.readline().split())) for _ in range(N)]

    nzshops = [(a, b) for a, b in shops if a > 0]
    zshops  = [(a, b) for a, b in shops if a == 0]

    nzshops.sort(key=lambda x: x[0] / (x[0] + x[1] + 1), reverse=True)
    zshops.sort()

    dp = [[0] + [INF] * int(math.log(T_MAX, 2)) for _ in range(len(nzshops) + 1)]
    for i in range(1, len(dp)):
        for c in range(1, len(dp[i])):
            a, b = nzshops[i - 1]
            t = dp[i - 1][c - 1] + 1
            dp[i][c] = min(dp[i - 1][c], t + t * a + b)

    rs = list(itertools.accumulate(1 + b for _, b in zshops))
    ans = max(c + bisect.bisect(rs, T - dp[-1][c])
            for c in range(len(dp[-1])) if dp[-1][c] <= T)

    print(ans)

if __name__ == '__main__':
    main()
N,a,b=(int(x) for x in input().split())

n = 1
result_str = ""
while n <= N:
    result_str += "b"*a
    n += a
    result_str += "r"*b
    n+= b
    
print(result_str[:8].count("b"))

### FIXED CODE ###

N,a,b=(int(x) for x in input().split())

num_char = (int(N /(a+b)))
num_joyo = (N %(a+b))
result = 0

if num_joyo <= a:
    result = num_char*a + (num_joyo)
else:
    result = num_char*a + a
    
print(result)
inputArr = input().split(" ")
X =  inputArr[0]
t =  inputArr[1]
remain_sand = int(X - t)
if remain_sand > 0 :
  print(remain_sand)
else :
  print(0)

### FIXED CODE ###

inputArr = input().split(" ")
X =  inputArr[0]
t =  inputArr[1]
remain_sand = int(X) - int(t)
if remain_sand > 0 :
  print(remain_sand)
else :
  print(0)
N, K = map(int, input().split(" "))
flag = [for 1 in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split(" ")):
    flag[j-1] = 0
sum(flag)

### FIXED CODE ###

N, K = map(int, input().split(" "))
flag = [1 for i in range(N)]
for i in range(K):
  input()
  for j in map(int,input().split(" ")):
    flag[j-1] = 0
print(sum(flag))
import sys
sys.setrecursionlimit(100000)

N,K=map(int,input().split())

mod=10**9+7

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = (cmb(n-1,r) + cmb(n-1,r-1))%mod
    return nCr[(n,r)]

for i in range(K):
    print((cmb(N-K+1,i+1)*cmb(K-1,i))%mod)

### FIXED CODE ###

from operator import mul
from functools import reduce

from operator import mul
from functools import reduce

N,K=map(int,input().split())

mod=10**9+7

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under%mod

for i in range(K):
    if i<N-K+1:
        print((cmb(N-K+1,i+1)*cmb(K-1,i))%mod)
    else:
        print(0)
import sys
n = list(map(int, sys.stdin.readline()))
s = sum(i if i <= 5 else 10 - i for i in n)

print(s)


### FIXED CODE ###

n = list(map(int, input()[::-1])) + [0]
s = 0
res = 0
for i, ni in enumerate(n[:-1]):
    k = ni + s
    if k < 5 or (k == 5 and int(n[i + 1]) < 5):
        res += k
        s = 0
    else:
        res += 10 - k
        s = 1
res += s
print(res)
n,m = map(int,raw_input().split())
a = []
buf = -111
for q in range(m):
  a.append(int( raw_input() ))
  if buf - a[q] == 1:
    print 0
    exit(0)

now = [0]*100001
now[0] = 1
if a[0] == 1: now[1] = 0
else: now[1] = 1

for q in range(2,n+1):
  if q in a: continue
  now[q] = now[q-1] + now[q-2]
  
print now[q] % 1000000007

### FIXED CODE ###

n,m = map(int,raw_input().split())
a = []
buf = -111
for q in range(m):
  a.append(int( raw_input() ))
  buf = a[q]
  if buf - a[q] == 1:
    print 0
    exit(0)

if n==1:
  print 1
  exit(0)
if n==2:
  if m==1:
    print 1
    exit(0)
  if m==0:
    print 2
    exit(0)

now = [-1]*100001

if m == 0:
  now[0] = 1
  now[1] = 1
  for q in range(2,n+1):
    now[q] = (now[q-1] + now[q-2]) % 1000000007
  print now[q] % 1000000007
  exit(0)
    
now[0] = 1
if a[0] == 1: now[1] = 0
else: now[1] = 1

for q in a:
  now[q] = 0

for q in range(2,n+1):
  if now[q] != -1: continue
  now[q] = (now[q-1] + now[q-2]) % 1000000007
  
print now[q] % 1000000007
# from fractions import gcd
from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)


### FIXED CODE ###

from fractions import gcd
# from math import gcd

a, b = map(int, input().split())
print(a * b // gcd(a, b))
exit(0)
#3N numbers
n=int(input())
lists=list(map(int,input().split()))
second=lists.copy()
second=second[::-1]
for i in range(3*n):
    second[i]=-second[i]    
MAX=sum(lists[:n])
MIN=-sum(second[:n])
MAXlist=[0 for i in range(n+1)]
MINlist=[0 for i in range(n+1)]
MAXlist[0]=MAX
MINlist[0]=MIN
ANS=-10**100
import heapq
a=lists[:n]
b=second[:n]
heapq.heapify(a)  # リストを優先度付きキューへ
for j in range(n,2*n):
    heapq.heappush(a,lists[j])  # 要素の挿入    
    heapq.heappush(b,second[j])
    mini=heapq.heappop(a)  # 最小値の取り出し
    mini2=heapq.heappop(b)
    MAX-=mini
    MIN+=mini2
    MAX+=lists[j]
    MIN-=second[j]
    MAXlist[j+1-n]=MAX
    MINlist[j+1-n]=MIN
MINlist=MINlist[::-1]
for i in range(n+1):
    ANS=max(ANS,MAXlist[i]-MINlist[i])
print(ANS)


### FIXED CODE ###

# 3 N numbers
import heapq
N = int(input())
a = list(map(int, input().split()))
S = sum(a[:N])
b = a[:N]
heapq.heapify(b)
dpmax = [S for i in range(N+1)]
# dpmax[x] = 前半　ｘ + N このうちmax N　このわを記録
for i in range(N, 2*N):
    heapq.heappush(b, a[i])
    d = heapq.heappop(b)
    S += a[i]-d
    dpmax[i-N+1] = S

c = a[-N:]
for i in range(N):
    c[i] = -c[i]
T = sum(c)
heapq.heapify(c)
dpmin = [-T for i in range(N+1)]

# dpmin[x]= 後半　x + N このうち　min Nこのわを記録する
for i in range(N, 2*N):
    heapq.heappush(c, -a[-1-i])
    d = heapq.heappop(c)
    T += -a[-1-i]-d
    dpmin[i+1-N] = -T

ans = -1000000000000000000000000000000
for i in range(N+1):
    ans = max(ans, dpmax[i]-dpmin[N-i])
print(ans)
s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
    else:
        li2.append(c)
        c = 0
print(max(li2))

### FIXED CODE ###

s = list(input())
c = 0
li = ["A","C","G","T"]
li2 = []
for i in range(len(s)):
    if s[i] in li:
        c += 1
        
    else:
        li2.append(c)
        c = 0
li2.append(c)
print(max(li2))
from collections import deque
n = int(input())
work = []
for i in range(n):
    a = int(input())
    work.append([list(map(int, input().split())) for i in range(a)])
result = 0
for i in range(n):
    count = 0
    d = deque([work[i]])
    honest = deque([i])
    unkind = deque()
    while len(d) > 0:
        human = d.popleft()
        for x, y in human:
            if y == 1:
                if x not in honest:
                    d.append(work[x-1])
                    honest.append(x)
            else:
                if x not in unkind:
                    unkind.append(x)
    finish = False
    while not finish:
        finish = True
        for i in range(1, n+1):
            if i not in honest and i not in unkind:
                flag = True
                for x, y in work[i-1]:
                    if y == 1 and x in unkind:
                        flag = False
                        break
                    elif y == 0 and x in honest:
                        flag = False
                        break
                    elif x not in honest+unkind:
                        finish = False
                if flag:
                    honest.append(i)
                else:
                    unkind.append(i)
    if len(set(honest) & set(unkind)) == 0:
        count = n - len(unkind)
        result = result if result > count else count
print(result)

### FIXED CODE ###

from collections import deque
n = int(input())
work = []
for i in range(n):
    a = int(input())
    work.append([list(map(int, input().split())) for i in range(a)])
result = 0
for i in range(2**n):
    state = bin(i)[2:].zfill(n)
    honest = []
    unkind = []
    for j in range(n):
        if state[j] == "0":
            unkind.append(j+1)
        else:
            honest.append(j+1)
    flag = True
    for human in honest:
        for x, y in work[human-1]:
            if y == 1 and x in unkind:
                flag = False
                break
            elif y == 0 and x in honest:
                flag = False
                break
        if not flag:
            break
    if flag:
        result = result if result>len(honest) else len(honest)
print(result)
X,Y,Z = int(input().split())
n = X
X = Z
Z = Y
Y = n
print(X, Y, Z)

### FIXED CODE ###


A = list(map(int,input().split()))
n = A[0]
A[0] = A[2]
A[2] = A[1]
A[1] = n
print(A[0], A[1], A[2])
def resolve():
    N, K = [int(i) for i in input().split()]
    import math
    ans = 0
    for i in range(1, N + 1):
        if i < K:
            coin = math.ceil(math.log2(K / i))
            ans += (1 / N) * ((1 / 2)**coin)
        else:
            ans += (1 / N)
    print(ans)


resolve()


### FIXED CODE ###

n,k=map(int,input().split())
ans=0
for i in range(1, n+1):
    tmp=1/n
    p=i
    while p<k:
        p=2*p
        tmp=tmp/2
    ans+=tmp
print(ans)
n,m,c=map(int,input().split())
b=list(map(int,input().split()))
a=[list(map(int,input().split())) for d in range(n)]
ans=0
for i in range(n):
  C=c
  for j in range(m):
    C=C+a[i][j]*b[j]
    if C>0:
      ans=ans+1
print(ans)


### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print((H-h)*(W-w))
def for_factorial(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
    return int(val/2)
N = int(input())
l = []
_l = [] #並び替えた文字列の格納
_c = 0 #カウントの総合
#1)リストの作成
for i in range(N):
    l.append(input())
#2)文字列の並び替えを"_l"に格納
for s in l:
    one_l = [c for c in s]
    one_l.sort()
    _one_l = "".join(one_l)
    _l.append(_one_l)
#3)アナグラム判定
for s in _l[:]:
    c = _l.count(s)
    if c > 1:
        #cの組み合わせを考える c C 2 
        _c += for_factorial(c)
        _l.remove(s)
print(_c)

### FIXED CODE ###

A, B = map(int, input().split())
M = []
kakeru = A*B
tasu = A+B
hiku = A-B
M.append(kakeru)
M.append(tasu)
M.append(hiku)
M.sort(reverse = True)
print(M[0])
import numpy as np
from math import ceil, floor

n = int(input())
l = [int(input()) for x in range(n)]

c = ceil(np.array(l).mean())
f = floor(np.array(l).mean())


print(min(sum([(x-c)**2 for x in l]), sum([(x-f)**2 for x in l])))

### FIXED CODE ###

import numpy as np
from math import ceil, floor
 
n = int(input())
l = [int(x) for x in input().split()]
 
c = ceil(np.array(l).mean())
f = floor(np.array(l).mean())

print(min(sum([(x-c)**2 for x in l]), sum([(x-f)**2 for x in l])))
import math
def main():
    A,B,C,D=input().split()
    A=int(A)
    B=int(B)
    C=int(C)
    D=int(D)
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    if A%(C*D/math.gcd(C,D))!=0:
        CD_min=A-A%(C*D/math.gcd(C,D))+(C*D/math.gcd(C,D))
    else:
        CD_min=A
    CD_max=B-B%(C*D/math.gcd(C,D))
    C_sum=(C_max-C_min)/C+1
    D_sum=(D_max-D_min)/D+1
    CD_sum=(CD_max-CD_min)/(C*D/math.gcd(C,D))+1
    sum= B-A+1-(C_sum+D_sum-CD_sum)
    return sum

sum=main()
print(sum)

### FIXED CODE ###

def gcd(a,b):
    if a < b:
        a, b = b, a
    while a % b != 0:
        a, b = b, a % b
    return b
def main():
    A,B,C,D=map(int,input().split())
    if A%C!=0:
        C_min=A-A%C+C
    else:
        C_min=A
    C_max=B-B%C
    if A%D!=0:
        D_min=A-A%D+D
    else:
        D_min=A
    D_max=B-B%D
    mod=C*D//gcd(C,D)
    if A%mod!=0:
        CD_min=A-A%mod+mod
    else:
        CD_min=A
    CD_max=B-B%mod
    C_sum=(C_max-C_min)//C
    D_sum=(D_max-D_min)//D
    CD_sum=(CD_max-CD_min)//mod
    sum= B-A+1-int(C_sum+D_sum-CD_sum+1)
    return sum
print(int(main()))
s=input()
if s[3]=s[4] and s[5]=s[6]:
 print("Yes")
else if:
 print("No")

### FIXED CODE ###

s = input()
if s[2] == s[3] and s[4] == s[5]:
  print("Yes")
else:
  print("No")
a=int(input())
li = list(map(int,input().split()))

n=1
for i in  list
    n*=n*list[i]

if(n>1000000000000000000):
    print("-1")
else:
    print(n)


### FIXED CODE ###

a=int(input())
li = list(map(int,input().split()))
 
n=1
if(0 in li):
	print(0)
else:
	for i in li:
		n=n*i
		if(n>1000000000000000000):
			n=-1
			break
	print(n)
a = input()
b = input()
print a * b, 2 * a + 2 * b

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
N = int(input())

lis = []

lis = list(map(int,input().split()))

first = []*N

for i in range(N):
  num = lis[i]
  first[num] = i + 1
  
for i in range(N):
  print(first[i],end=' ')

### FIXED CODE ###


N = int(input())
lis = []
lis = list(map(int,input().split()))
first = [0]*N

for i in range(N):
    num = lis[i] - 1
    first[num] = i

for i in range(N):
    print(first[i]+1,end=' ')
print()
import numpy as np


N, M = map(int, input().split())

P = [None] * M
Y = [None] * M

X = [None] * (N + 1)
Y = [None] * (N + 1)

for n in range(N + 1):
    X[n] = []

for m in range(M):
    P[m], Y[m] = map(int, input().split())
    X[P[m]] = X[P[m]] + [Y[m]]

for i in range(len(X)):
    Y[i] = (np.argsort(np.array(X[i])) + 1).tolist()

for p in P:
    print('%06d%06d' % (p, Y[p].pop(0)))


### FIXED CODE ###

from itertools import chain


N, M = map(int, input().split())

P = [0] * N

I = list(range(M))

Q = [None] * M
Y = [None] * M

for m in range(M):
    Q[m], Y[m] = map(int, input().split())
    P[Q[m]-1] += 1

D = zip(I, Q, Y)
D = sorted(D, key=lambda x: [x[1], x[2]])
I, Q, Y = map(list, zip(*D))

P = list(chain.from_iterable([list(range(1, p+1)) for p in P]))

D = zip(I, Q, Y, P)
D = sorted(D, key=lambda x: x[0])
I, Q, Y, P = map(list, zip(*D))

for i in range(M):
    print('%06d%06d' % (Q[i], P[i]))
N = input()
N = int(N)
A = list(map(int,input().split()))
B = [ i for i in A if i % 2 == 0 or ]
C = [ d for d in B if i % 3 == 0 or i % 5 == 0]
R = len(C)
if R == 0:
  print("APPROVED")
else:
  print("DENIED")

### FIXED CODE ###

N = input()
N = int(N)
A = list(map(int,input().split()))
B = [ i for i in A if i % 2 ==0]
C = [ d for d in B if  d % 3 == 0 or d % 5 == 0]
R = len(C)
Q = len(B)
if R == Q:
  print("APPROVED")
  
else:
  print("DENIED")
x = int(input())
a = 500
b = 5
q = x//a
mod = x%a
if q > 0:
  c = q * 1000
elif mod // b > 0:
  d = (mod // b) * 5
  print(c + d)
else:
  print('0')
  

### FIXED CODE ###

x = int(input())
s = 1000*(x//500) + 5*((x%500)//5)
print(s)
s = int(input())
k = int(input())
 
ans=0
 
n  = 5000000000000000
 
S = str(s) #文字列にする
L = len(S)
saisho = 0
 
for i in range(L):
  N = int(S[i])
  if N == 1:
    Nn == 1
  else:
    Nn = N**n
    
  if saisho <= k <= saisho + Nn:#最初からの文字数
    ans = N
    break
    
  else:
    saisho += Nn
    
print(ans)

### FIXED CODE ###

s = int(input())
k = int(input())
S = str(s) #文字列にする

ans=0

for i in range(k):
  N = int(S[i])
  
  if N == 1:
    ans = 1
  else:
    ans = N
    break  
print(ans)
import itertools

n,m = map(int,input().split())
path=[[False]*n for _ in range(n)]
for _ in range(m):
  a,b = map(int,input().split())
  a-=1
  b-=1
  path[a][b]=True
  path[b][a]=True
ans=0

for i in itertools.permutations(range(6), 6):
   if i[0] == 0:
     for j in range(n):
       if j==n-1:
         ans+=1
         break
       if not path[i[j]][i[j+1]]:
         break

print(ans)

### FIXED CODE ###

import itertools

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

path = [[False] * n for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    path[a][b] = True
    path[b][a] = True

ans = 0

# 頂点を並び替える順列を生成してループ
for i in itertools.permutations(range(n), n):
    # 頂点1が始点
    if i[0] == 0:
        # 生成した順列の中をさらにループ
        for j in range(n):
            # n - 1 まで続いたら条件を満たすパスが存在する
            if j == n - 1:
                ans += 1
                break
            # i[j] から i[j + 1] に行くパスがなければ終了
            if not path[i[j]][i[j + 1]]:
                break

print(ans)
# coding=utf-8
from math import floor, ceil, sqrt, factorial, log, gcd, log10
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement, chain
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heappushpop, heapify
from copy import copy, deepcopy
import sys
INF = float('inf')
mod = 10**9+7
sys.setrecursionlimit(10 ** 9)


def lcm(a, b): return a * b / gcd(a, b)

# 1 2 3
# a, b, c = LI()


def LI(): return list(map(int, sys.stdin.buffer.readline().split()))

# a = I()


def I(): return int(sys.stdin.buffer.readline())

# abc def
# a, b = LS()


def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

# a = S()


def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')

# 2
# 1
# 2
# [1, 2]


def IR(n): return [I() for i in range(n)]

# 2
# 1 2 3
# 4 5 6
# [[1,2,3], [4,5,6]]


def LIR(n): return [LI() for i in range(n)]

# 2
# abc
# def
# [abc, def]


def SR(n): return [S() for i in range(n)]

# 2
# abc def
# ghi jkl
# [[abc,def], [ghi,jkl]]


def LSR(n): return [LS() for i in range(n)]

# 2
# abcd
# efgh
# [[a,b,c,d], [e,f,g,h]]


def SRL(n): return [list(S()) for i in range(n)]


# https://qiita.com/greenteabiscuit/items/31c46ab3ceac07e749d2


n, m = LI()
graph = [[] for _ in range(m)]
v = [False] * n

for i in range(m):
    a, b = LI()
    graph[a - 1].append(b)
    graph[b - 1].append(a)


def dfs(now, depth):
    if v[now - 1]:
        return 0
    if depth == n-1:
        return 1
    ans = 0
    v[now - 1] = True
    for node in graph[now - 1]:
        ans += dfs(node, depth+1)

    v[now - 1] = False
    # ここが大事.上で探索の一つが終わるからリセットしている.

    return ans


print(dfs(1, 0))


### FIXED CODE ###

#Nはノード数、Mはエッジ数
N, M = map(int, input().split())

path_matrix = []

#無向行列の初期化
for n in range(N):
    path_matrix.append([False] * N)

#まず無向グラフを表す行列を作る
for m in range(M):
    line = map(int, input().split())
    paths = [x - 1 for x in line]
    path_matrix[paths[0]][paths[1]] = True
    path_matrix[paths[1]][paths[0]] = True

#最初はvisited、つまり訪問したことのあるノードはひとつもないので、Falseにする
visited = [False] * N


#再帰関数、ここが難しいかもしれない。
def dfs(now, depth):
    if visited[now]:
        return 0
    if depth == N - 1:
        return 1

    visited[now] = True
    total_paths = 0
    for i in range(0, N):
        if path_matrix[now][i]:
            total_paths += dfs(i, depth + 1)

    visited[now] = False

    return total_paths

print(dfs(0, 0))
a,b,h = map(int,input().split())

print((a+b)*h//2)

### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

print(((a+b)*h)//2)
# coding: utf-8

N, M, Q = map(int,input().split())
L = []
A = [1] * N
ans = 0

for i in range(Q):
    l = list(map(int,input().split()))
    L.append(l)

L.sort(key=lambda x:x[3])

for i in range(Q):
    a=L[i][0]
    b=L[i][1]
    c=L[i][2]
    d=L[i][3]
    if A[b-1] <= A[a-1] + c <= M:
        ans += d
        #print(ans)
        A[b-1:] = [A[a-1] + c] * (N-A[a-1]+c-1)
print(ans)

### FIXED CODE ###

# coding: utf-8
import itertools
N, M, Q = map(int,input().split())
L = list(itertools.combinations_with_replacement(range(1, M + 1), N))
D = []
for i in range(Q):
    D.append(list(map(int,input().split())))

#print(l)
#全てのA

ans = 0
for A in L:
    tmp = 0
    for i in range(Q):
        a = D[i][0]
        b = D[i][1]
        c = D[i][2]
        d = D[i][3]
        if A[b-1] - A[a-1] == c:
            tmp += d
        
        ans = max(ans,tmp)

print(ans)