z=list(map(int,input().split()))
z.sort()
a=0

while True:
    if z[1]==z[0]:
        break
    a=z[1]-z[0]
    if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
    z[1]=z[0]
    z[0]=a
    z.sort()

print(z[0]) z=list(map(int,input().split())) z list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split z.sort() z.sort z sort a=0 a 0 while True:
    if z[1]==z[0]:
        break
    a=z[1]-z[0]
    if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
    z[1]=z[0]
    z[0]=a
    z.sort() True if z[1]==z[0]:
        break
     z[1]==z[0] z[1] z 1 z[0] z 0 break a=z[1]-z[0] a z[1]-z[0] z[1] z 1 z[0] z 0 if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
     z[0]%a==0 z[0]%a z[0] z 0 a 0 z[1] = z[0] z[1] z 1 z[0] z 0 z[0] = a z[0] z 0 a z.sort() z.sort z sort break z[1]=z[0] z[1] z 1 z[0] z 0 z[0]=a z[0] z 0 a z.sort() z.sort z sort print(z[0]) print z[0] z 0 a=0 0 a z=list(map(int,input().split())) list(map(int,input().split())) z a=z[1]-z[0] z[1]-z[0] a
z=list(map(int,input().split()))
z.sort()
a=0

while True:
    if z[1]==z[0]:
        break
    a=z[1]-z[0]
    if z[0]%a==0:
        z[1] = z[0]
        z[0] = a
        z.sort()
        break
    z[1]=z[0]
    z[0]=a
    z.sort()

print(z[0])