Harryxun/stf_run huggingface dataset:
class GCD():
    def __init__(self,a,b):
        self.a = a
        self.b = b

    def swap(self):
        temp = self.a
        self.a = self.b
        self.b = temp

    def gcd(self):
        if self.b < self.a:
            self.swap()

        temp = self.b % self.a

        if temp == 0:
            ans = self.a
            return ans

        ans = self.b % temp

        return ans

    def lcm(self):
        gcd = self.gcd()
        temp = self.a * self.b
        ans = temp // gcd
        return gcd,ans

    def print(self):
        num = self.lcm()
        print("{0} {1}".format(num[0],num[1]))

def main():
    data = []

    while 1:
        try:
            n = input().split()

            a = int(n[0])
            b = int(n[1])

            data.append(GCD(a, b))

        except EOFError:
            break

    for array in data:
        array.print()

if __name__ == "__main__":
    main()


### FIXED CODE ###

class GCD():
    def __init__(self,a,b):
        self.a = a
        self.b = b

    def gcd(self):
        if self.a < self.b:
            self.a, self.b = self.b, self.a
        while self.b:
            self.a, self.b= self.b, self.a % self.b

        return self.a

    def print(self):
        lcm = self.a * self.b // self.gcd()
        print(self.gcd(), lcm)

def main():
    data =[]

    while 1:
        try:
            n = input().split()

            a = int(n[0])
            b = int(n[1])

            data.append(GCD(a, b))

        except EOFError:
            break

    for array in data:
        array.print()

if __name__ == "__main__":
    main()
n,x = map(int,input().split())

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

zahyo = 0
i = 0
while(zahyo <= x):
    
    zahyo = zahyo + li[i]
    print(zahyo)
    
    if zahyo <= x:
        i = i+1

print(i+1)

### FIXED CODE ###

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

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

zahyo = 0
i = 0
while(zahyo <= x):
    
    zahyo = zahyo + li[i]
    
    if zahyo <= x:
        i = i+1
    if i == n:
        break

print(i+1)
n,k=map(int,input().split())
h=map(int,inout().split())
x=0
for i in range(0,len(h)):
  if h[i]>=k:
      x+=1

print(x)      
 

### FIXED CODE ###

n,k=map(int,input().split())
h=list(map(int,input().split()))
x=0
for i in range(0,len(h)):
  if h[i]>=k:
    x+=1

print(x)
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a_list = list(map(int,input().split()))


ans = 0
for i in range(n):
    init = a_list[:]
    init.pop(i)
    gcd = gcd_list(init)
    if ans < gcd:
        ans = gcd

print(ans)

### FIXED CODE ###

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

ans = [i for i in range(1,30) if i%a == 0 and i<t+0.5]
print(len(ans)*b)
N = int(input())
A = [int(x) for x in input().split()]
B = A
count=0
while len(B)!=0:
  b=B[1]
  C=[i for i in B if i != b]
  count+=(len(B)-len(C))*(len(B)-len(C)-1)/2
  B=C
ans=list(map(lambda x: count-(A.count(x)-1),A))
for x in ans:
  print(int(x))

### FIXED CODE ###

from collections import Counter
N = int(input())
B = [int(x) for x in input().split()]
A=Counter(B)
V, C = zip(*A.most_common())
count=0
i=0
dict={}
for x in C:
  count+=x*(x-1)/2
  dict[V[i]]=x
  i+=1
for x in B:
  ans=count-dict[x]+1
  print(int(ans))
N=int(input())
A=int(input())
B=int(input())
if(N==1):
  print("Hello World")
if(N==2):
  print(A+B)

### FIXED CODE ###

N=int(input())
if(N==1):
  print("Hello World")
if(N==2):
  A=int(input())
  B=int(input())
  print(A+B)
(n,m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.oppend([int(j) for j in input().split()])

for i in range(m):
    b.oppend(int(input()))

for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)
    

### FIXED CODE ###

(n, m) = [int(i) for i in input().split()]
A = []
b = []
for i in range(n):
    A.append([int(j) for j in input().split()])
 
for i in range(m):
    b.append(int(input()))
 
for i in range(n):
    s = 0
    for j in range(m):
        s += A[i][j] * b[j]
    print(s)
N, A, B = map(int, input().split())
print(sum(i for i in range(N+1)) if A <= sum(map(int, str(i)))<= B)

### FIXED CODE ###

N, A, B = map(int, input().split())
print(sum(i for i in range(N+1) if A <= sum(map(int, str(i)))<= B))
n = int(input())
k = int(input())
s = input()
result = ''
for i in range(n):
    if i == k-1:
        result += chr(ord(s[i]) + 32)
    else:
        result += s[i]
print(result)

### FIXED CODE ###

n, k = input().split()
a = int(n)
b = int(k)
s = input()
result = ''
for i in range(a):
    if i == b-1:
        result += chr(ord(s[i]) + 32)
    else:
        result += s[i]
print(result)
from scipy.special import comb
def cmb(n,r):
    return comb(n, r)

n = int(input())
ss = [input() for _ in range(n)]

march = ['M','A','R','C','H']
d = dict(zip(march, [0]*5))

nn = 0

for s in ss:
    if s[0] in march:
        d[s[0]] += 1
        nn += 1

ans = comb(nn, 3)
for i in d.values():
    if i >= 2:
        if i > 3:
            ans -= comb(i, 3)
        ans -= comb(i,2)*(nn-i)

print(int(ans))

### FIXED CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    if n < r: return 0
    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

n = int(input())
ss = [input() for _ in range(n)]
march = ['M','A','R','C','H']
d = dict(zip(march, [0]*5))

nn = 0

for s in ss:
    if s[0] in march:
        d[s[0]] += 1
        nn += 1
if nn < 3:
    print(0)
    exit()

ans = cmb(nn, 3)
for i in d.values():
    if i >= 2:
        if i > 3:
            ans -= cmb(i, 3)
        ans -= cmb(i,2)*(nn-i)

print(int(ans))
import sys,math
sys.setrecursionlimit(10**9)
import itertools
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())

n=int(input())
temp=[]
num=0
x=1
for i in range(1,n+1):
  x*=2
for st in itertools.permutations(a,n):
    temp.append(st)
    num+=1
    if num==x-i:break

for x in temp:
  for i in x:
    print(x[i],end="")
  print()
  


### FIXED CODE ###

import sys,math
sys.setrecursionlimit(10**9)
import itertools
from collections import defaultdict
 
IA = lambda: map(int,input().split())
IAS= lambda: map(str,input().split())


n=int(input())


def dfs(s,lim):

    
    if len(s)==n:
        print(s)
    else:
        for i in range(ord('a'),ord(lim)+1):
            
            if i==ord(lim):
                dfs(s+chr(i),chr(ord(lim)+1))
            else:
                dfs(s+chr(i),lim)

dfs('','a')
N=list(map(int,input()))
N.reverse()
N.append(0)
n=len(N)
pay=[0]*n
price = N.copy()

for i in range (n):
    if N[i]>5:
        pay[i]=0
        N[i+1]=N[i+1]+1
    elif  N[i]<5:
        pay[i]=N[i]
    else:
        if N[i+1]>=5:
            pay[i]=0
            N[i+1]=N[i+1]+1
        else:
            pay[i]=N[i]


#print(price)
#print(pay)
sum_pay=sum(pay)

c=0
for i in range (n):
    if pay[i]-price[i]>=0:
        c=c+pay[i]-price[i]
    else:
        c=c+10+pay[i]-price[i]
        pay[i+1]=pay[i+1]-1

sum_otsuri=c

#print(sum_otsuri)
#print(sum_pay)

sum=sum_otsuri+sum_pay
print(sum)

### FIXED CODE ###

N=list(map(int,input()))
N.reverse()
N.append(0)
n=len(N)
pay=[0]*n
price = list(N)

for i in range (n):
    if N[i]>5:
        pay[i]=0
        N[i+1]=N[i+1]+1
    elif  N[i]<5:
        pay[i]=N[i]
    else:
        if N[i+1]>=5:
            pay[i]=0
            N[i+1]=N[i+1]+1
        else:
            pay[i]=N[i]


#print(price)
#print(pay)
sum_pay=sum(pay)

c=0
for i in range (n):
    if pay[i]-price[i]>=0:
        c=c+pay[i]-price[i]
    else:
        c=c+10+pay[i]-price[i]
        pay[i+1]=pay[i+1]-1

sum_otsuri=c

#print(sum_otsuri)
#print(sum_pay)

sum=sum_otsuri+sum_pay
print(sum)
a,b=map(int, input().split())

for i in range(a):
     for j in range(b):
          print("#")
          return
     print(/n)


### FIXED CODE ###

while True:
    a,b=map(int,input().split())
    if a==0 and b==0:break
    for i in range (a):
        print('#'*b)
    print()
N, X =map(int,input().split())
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)
import fractions
D= result[0]
for i in range (1,len(result)):
    D=fractions.gcd(D,result[i])
print(D)

### FIXED CODE ###

import numpy as np
import fractions

N, X =map(int,input().split())
x = list(map(int,input().split()))
result = abs(abs(np.array(x))-X)

D= result[0]
for i in range (1,len(result)):
    D=fractions.gcd(D,result[i])
print(D)
#coding:UTF-8

a,op,b = map(str,raw_input().split())
a = int(a)
b = int(b)

while True:
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a / b
    else:
        break:

### FIXED CODE ###

#coding:UTF-8

while True:
    a,op,b = map(str,raw_input().split())
    a = int(a)
    b = int(b)
    if op == '+':
        print a + b
    elif op == '-':
        print a - b
    elif op == '*':
        print a * b
    elif op == '/':
        print a / b
    else:
        break
#ITP1_6_B


n= int(input())

T=[[0 for j in range(13)]for m in range(4)]
format(T)

for i in range(n):
    a,b = input().split()
    b=int(b)
    
    if a=='S':
        T[0][b] = 1
    elif a=='H':
      T[1][b] = 1
    elif a=='C':
      T[2][b] = 1
    else:
      T[3][b] = 1
c=int(0)
d=int(0)
for j in range(4):
  for i in range (13):
    if T[c][d] == 0:
      if c==0:
        K = "S"
      elif c==1:
        K = "H"
      elif c==2:
        K = "C"
      else:
        K = "D"
    print(K,d)
    d=d+1
  c=c+1
    


### FIXED CODE ###

#ITP1_6_B


n= int(input())

T=[[0 for j in range(13)]for m in range(4)]
format(T)

for i in range(n):
    a,b = input().split()
    b=int(b)
    
    if a=='S':
      T[0][b-1] = 1
    elif a=='H':
      T[1][b-1] = 1
    elif a=='C':
      T[2][b-1] = 1
    else:
      T[3][b-1] = 1
for c in range(4):
  for d in range (13):
    if T[c][d] == 0:
      if c==0:
        K = "S"
      elif c==1:
        K = "H"
      elif c==2:
        K = "C"
      else:
        K = "D"
      print(K,d+1)
    else:
      pass
N=int(input())
A=list(map(int,input().split()))

ans=0
pre=A[1]-A[0]
cool=True
for i in range(N-2):
    temp=A[i+2]-A[i+1]
    if pre*temp<0 and cool:
        ans+=1
        cool=False
    else:
        cool=True
    pre=temp

print(ans+1)    
    

    

### FIXED CODE ###

# coding: utf-8
# Your code here!
_=int(input())
A=list(map(int,input().split()))
N=len(A)

trend=0
ans=0
for i in range(N-1):
    temp=A[i+1]-A[i]
    if trend==0:
        if temp>0:
            trend=1
            ans+=1
        elif temp<0:
            trend=-1
            ans+=1
        else:
            pass
    elif trend==1:
        if temp>0:
            pass
        elif temp<0:
            trend=0
        else:
            pass
    elif trend==-1:
        if temp>0:
            trend=0
        elif temp<0:
            pass
        else:
            pass

print(ans if trend!=0 else ans+1)
n=int(input())
c1=c2=c3=0
c=0
for i in range(n):
  s=input()
  c+=s.count('AB')

  if s[0]=='B' and s[-1]=='A':
    c3+=1
  elif s[0]=='B':
    c1+=1
  elif s[-1]=='A':
    c2+=1

_c=c
_c+=max(0,c3-1)
_c1=c1
_c2=c2
if c1>0
  _c+=1
  _c1-=1
if c2>0:
  _c+=1
  _c2-=1
if c1<c2:
  _c2-=c1
  _c+=c1
  if _c2>0 and c3>0:
    _c+=1
elif c1==c2:
  if c3>0:
    _c+=1
    _c1-=1
    _c2-=1
  _c+=_c1
else:
  _c1-=c2
  _c+=c2
  if _c1>0 and c3>0:
    _c+=1

print(_c)

# if c3>max(c1,c2):
#   if c1<c2:
#     c+=c1*2
#     c3-=c1
#     c+=c3
#   elif c1==c2:
#     c+=c1*2
#     c3-=c1
#     c+=max(0,c3-1)
#   else:
#     c+=c2*2
#     c3-=c2
#     c+=c3
# elif c3>=min(c1,c2) and c3<=max(c1,c2):
#   if c1<c2:
#     c+=c1*2
#     c2-=c1
#     c3-=c1
#     c+=c3
#   else:
#     c+=c2*2
#     c1-=c2
#     c3-=c2
#     c+=c3
# else:
#   c+=c3*2
#   c1-=c3
#   c2-=c3
#   c+=min(c1,c2)

# print(max(c,_c))

### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  ans=0

  _ba=0
  _b=0
  _a=0
  for _ in range(n):
    s=S()
    ans+=s.count('AB')

    if s[0]=='B':
      if s[-1]=='A':
        _ba+=1
      else:
        _b+=1
    else:
      if s[-1]=='A':
        _a+=1

  ans+=max(0,_ba-1)

  if _ba>0:
    if _b>0:
      ans+=1
      _b-=1
    if _a>0:
      ans+=1
      _a-=1

  if _b>0 and _a>0:
    ans+=min(_b,_a)

  return ans

# main()
print(main())
N, W = map(int, input().split())
Wl, Vl = [], []
for i in range(N):
    w, v = map(int, input().split())
    Wl.append(w); Vl.append(v)

dp = [[10**9+1]*(10**7) for _ in range(N+2)]
dp[0][0] = 0

ans = 0
for i in range(N):
    w, v = Wl[i], Vl[i]
    for j in range(10**5+100):
        if j+v < 10**7+1:
            dp[i+1][j+v] = min(dp[i+1][j+v],
                                dp[i][j]+w)
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])
        if dp[i+1][j+v] <= W: ans=max(ans, j+v)
        if dp[i+1][j] <= W: ans=max(ans, j)
print(ans)

### FIXED CODE ###

import numpy as np
N, W = map(int, input().split())
dp = np.full(N*10**3+1, W+1)
dp[0] = 0

for i in range(N):
    w, v = map(int, input().split())
    dp[v:] = np.minimum(dp[v:], dp[:-v]+w)
print(np.where(dp<=W)[0][-1])
N,T=map(int,input().split())
list=[input() for _ in range(N)]

list1=[]
for i in range(N):
    X,Y=map(int,list[i].split(" "))
    if Y < T:
        list1.append(X)
print(min(list1))

### FIXED CODE ###

N,T=map(int,input().split())
list=[input() for _ in range(N)]

list1=[]
for i in range(N):
    X,Y=map(int,list[i].split(" "))
    if Y <= T:
        list1.append(X)
print(min(list1) if list1 != [] else "TLE")
import sys

N = int(input())
p_list = list(map(int, input().split()))

different_index = -1
should_place = -1
for i, p in enumerate(p_list):
    if different_index >= 0 and p != i + 1 and i != should_place:
        print("NO")
        sys.exit(1)

    if different_index == -1 and p != i + 1:
        different_index = i
        should_place = p - 1
        continue
    

if different_index == -1:
    print("YES")
elif p_list[should_place] == different_index + 1:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

N = int(input())
p_list = list(map(int, input().split()))

counter = 0
for pair in zip(p_list, range(1, len(p_list) + 1)):
    if pair[0] - pair[1] != 0:
        counter += 1

if counter == 0 or counter == 2:
    print("YES")
else:
    print("NO")
A = int(input())
B = int(input())
if A>9 or B>9:
  print ':('
else:
  print 'Yay!'

### FIXED CODE ###

A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b = "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)

### FIXED CODE ###

n = int(input())
btc = 0
jpy = 0
for i in range(n):
  a,b = input().split()
  if b == "BTC":
    btc += float(a)
  else:
    jpy += int(a)
print(jpy+btc*380000)
N = int(input())
A = list(map(int,input().split()))
A.sort()
l = [A.index(i+1) for i in range(max(A))]
l.append(N-1)
# print(l)

for i in range(N):
    if i >= len(l)-1:
        print(0)
    else:
        ans = l[i+1]-l[i]
        print(ans)


### FIXED CODE ###

N=int(input())
A=[int(x) for x in input().split()]
d=[0]*(N+1)
for i in range(N-1):
    d[A[i]]+=1
for i in range(1,len(d)):
    print(d[i])
age = int(input())

if age == 3,5,7:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

age = int(input())
 
if age == 3 or age == 5 or age == 7:
  print("YES")
else:
  print("NO")
a,b=map(int,input().split())
s=list(map(int,input().split()))
count=0
for i in range(b):
        for j in range(i,b):
            if a<s[i]+s[j] and count==0:
                print("yes")
                count+=1
if count==0:
    print("no")


### FIXED CODE ###

a,b=map(int,input().split())
count=0
while a>0:
    count+=1
    a-=b
print(count)
def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (int(_) for _ input().split())
        if y == 'JPY':
            sum += x
        elif y == 'BTC':
            sum += x * 380000.0
    print(sum)

if __name__  == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    sum = 0
    for i in range(N):
        x,y = (_ for _ in input().split())
        if y == 'JPY':
            sum += float(x)
        elif y == 'BTC':
            sum += float(x) * 380000.0
    print(sum)

if __name__  == '__main__':
    main()
n,m=map(int,input().split())
ans=[0 for i in range(n)]
f=[[True] for i in range(n)]
for i in range(m):
    s,c=map(int,input().split())
    if f[s-1]==False:
        if ans[s-1]!=c:
            print(-1)
            sys.exit()
    if f[s-1]:
        f[s-1]=False
    ans[s-1]=c
if ans[0]==0:
    print(-1)
    sys.exit()
a=map(str,ans)
print("".join(a))

### FIXED CODE ###

import sys
n,m=map(int,input().split())
ans=[0 for i in range(n)]
f=[[True] for i in range(n)]
if n==1:
    for i in range(m):
        s,c=map(int,input().split())
        if f[s-1]==False:
            if ans[s-1]!=c:
                print(-1)
                sys.exit()
        if f[s-1]:
            f[s-1]=False
        ans[s-1]=c
    
    a=map(str,ans)
    print("".join(a))
    sys.exit()

for i in range(m):
    s,c=map(int,input().split())
    if s==1 and c==0:
        print(-1)
        sys.exit()
    if f[s-1]==False:
        if ans[s-1]!=c:
            print(-1)
            sys.exit()
    if f[s-1]:
        f[s-1]=False
    ans[s-1]=c
if ans[0]==0:
    ans[0]=1
a=map(str,ans)
print("".join(a))
N, K [int(i) for i in input().split(' ')]

min = 0
prev = 0

while abs(N - K) > prev:
  min = abs(N - K)
  prev = min

print(min)
		

### FIXED CODE ###

N, K = [int(i) for i in input().split(' ')]

def res():
  if N == K:
    return 0
  elif N > K:
    return N % K if K - (N % K) > (N % K) else K - (N % K)
  else :
    return abs(N - K) if abs(N - K) < abs(abs(N-K) - K) else abs(abs(N-K) - K)

print(res())
import math
A,B=map(int,input().split())
print(A*B//(math.gcd(A,B)))

### FIXED CODE ###

import fractions
A,B=map(int,input().split())
print(A*B//(fractions.gcd(A,B)))
import sys
from math import factorial

def check(x, y):
    if x < y:
        tmp = x
        x = y
        y = tmp

    n = x - y
    x -= 2 * n

    if x + y % 3 == 0:
        return True
    else:
        return False
    

# Read
line = sys.stdin.readlines()[0]
X, Y = map(int,line.split(' '))

if not check(x, y):
    print(0)
    exit(0)

m = 1/3 * (2*Y - X)
n = Y - 2 * m

ans = factorial(n+m) / factorial(n)



### FIXED CODE ###

import sys
from math import factorial

def ncr(n, r, p): 
    # initialize numerator 
    # and denominator 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 

def check(x, y):
    if (x + y) % 3 == 0:
        return True
    else:
        return False
    

# Read
line = sys.stdin.readlines()[0]
X, Y = map(int,line.split(' '))

if not check(X, Y):
    print(0)
    exit(0)

m = int(1/3 * (2*Y - X))
n = int(Y - 2 * m)

if n < 0 or m < 0:
    print(0)
else:
    print(ncr(n+m, n, 10**9+7))
import numpy as np

#リスト内包表記
N = int(input())
A = [int(x) for x in input().split()]

#リストの総積を計算する
seki = np.prod(A)

#出力
if seki > 10**18:
    print("-1")
elif 0 in A:
    print("0")
else:
    print(seki)

### FIXED CODE ###

A,B = map(int, input().split())
print(A*B)
n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n):
  if (x[i+1]-x[i])*a>=b:
    ans+=b
  else:
    ans+=(x[i+1]-x[i])*a
print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in range(n-1):
  if (x[i+1]-x[i])*a>=b:
    ans+=b
  else:
    ans+=(x[i+1]-x[i])*a
print(ans)
t=input(str())
t=list(t)
for i in range(1,len(t)-1):
    if t[i]=='?':
        if t[i+1]=='D' :
            t[i]='P'
        elif t[i + 1] == '?':
            if t[i-1]=='P':
                t[i]='D'
            else:
                t[i]='P'
        else:
            t[i]='D'
    if t[0]=='?'
        t[1]='P'
    if t[-1]=='?':
        t[-1]='D'
print(''.join(t))

### FIXED CODE ###

t=input(str())
t=list(t)
for i in range(len(t)):
    if t[i]=='?':
      t[i]='D'
print(''.join(t))
s=list(input())
s1=[]
for i in range(len(s)):
  if s[i]!="x":
    s1.append(s[i])
s2=s1[::-1]
if s1!=s2:
  print(-1)
  exit()
A1=[0]*10**5
A2=[0]*10**5
i=0
j=0
while i<=len(s1)//2:
  if s[j]=="x":
    A1[i]+=1
    j=j+1
  else:
    i=i+1
    j=j+1
i=0
j=0
while i<=len(s1)//2:
  if s[-1-j]=="x":
    A2[i]+=1
    j=j+1
  else:
    i=i+1
    j=j+1
ans=0
for i in range(10**5):
  ans=ans+abs(A1[i]-A2[i])
print(ans)

### FIXED CODE ###

s=list(input())
s1=[]
for i in range(len(s)):
  if s[i]!="x":
    s1.append(s[i])
s2=s1[::-1]
if s1!=s2:
  print(-1)
  exit()
if s1==[]:
  print(0)
  exit()
A1=[0]*10**5
A2=[0]*10**5
i=0
j=0
while i<=len(s1)//2:
  if s[j]=="x":
    A1[i]+=1
    j=j+1
  else:
    i=i+1
    j=j+1
i=0
j=0
while i<=len(s1)//2:
  if s[-1-j]=="x":
    A2[i]+=1
    j=j+1
  else:
    i=i+1
    j=j+1
ans=0
for i in range(10**5):
  ans=ans+abs(A1[i]-A2[i])
print(ans)
from heapq import heappush, heappop
h,w=map(int,input().split())
l=[]
v=0

for _ in range(h):
  b=[0 if i=="." else 1 for i in input()]
  v+=b.count(1)
  l.extend([b])

heap=[]
heappush(heap,(1,0,0))
while h:
  d,x,y=heappop(heap)
  if x==w-1 and y==h-1:break
  for (dx,dy) in zip([1,0],[0,1]):
    ax=x+dx
    ay=y+dy
    if 0<=ax<w and 0<=ay<h and not l[ay][ax]:
      heappush(heap,(d+1,ax,ay))

if x==w-1 and y==h-1:
  print(h*w-v-d)
else:
  print(-1)

### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
l=[]
v=0

for _ in range(h):
  b=[0 if i=="." else 1 for i in input()]
  v+=b.count(1)
  l.extend([b])

dq=deque([])
dq.append((0,0,1))

while dq:
  x,y,d=dq.popleft()
  if x==w-1 and y==h-1:break
  for (dx,dy) in zip([-1,1,0,0],[0,0,-1,1]):
    nx=x+dx
    ny=y+dy
    if 0<=nx<w and 0<=ny<h and not l[ny][nx]:
      l[ny][nx]=2
      dq.append((nx,ny,d+1))

if x==w-1 and y==h-1:
  print(h*w-v-d)
else:
  print(-1)
N, M = map(int, input().split())

dp = [1, 2]
if M != 0:
    A = [int(input()) for _ in range(M)]
    if A[0] == 1:
        dp = [0, 1]
    elif A[0] == 2:
        dp = [1, 0]

MOD = 1000000007

if N == 1:
    print (1)
if N == 2:
    print (dp[-1])
else:
    cnt = 0
    for n in range(2, N):
        while(cnt != M - 1 and A[cnt] < n + 1):
            cnt += 1
        if A[cnt] == n + 1:
            dp[0] = dp[1]
            dp[1] = 0
        else:
            new_val = (max(dp[0], 0) + max(dp[1], 0)) % MOD
            dp[0] = dp[1]
            dp[1] = new_val

print (dp[-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
import numpy as np
N, M = map(int, input().split())

MOD = 1000000007
dp = np.zeros(N, dtype = int)
if M != 0:
    A = np.array([int(input()) for _ in range(M)], dtype = int)
    dp[A - 1] = -1


if dp[0] == -1 and dp[1] == -1:
    pass
else:
    if dp[0] == -1:
        dp[1] = 1
    elif N >= 2 and dp[1] == -1:
        dp[0] = 1
    elif N >= 2:
        dp[0] = 1
        dp[1] = 2
    else:
        dp[0] = 1


if N >= 3:
    for n in range(2, N):
        if dp[n] != -1:
            dp[n] = (max(dp[n-1], 0) + max(dp[n-2], 0)) % MOD

print (dp[-1])