def isAlt(a):
if len(a)<=1:
return False
for i in range(1, len(a)+1):
if a[i]*a[i-1] > 0:
return False
return True
def isGrow(a):
if len(a)<=1:
return False
for i in range(1, len(a)+1):
if a[i] < a[i-1]:
return False
return True
def isMulti(a):
q = a[1]/a[0]
if len(a)<=1:
return False
for i in range(2, len(a)):
if a[i] / a[i-1] != q:
return False
return True
def isAdd(a):
q = a[1]-a[0]
if len(a)<=1:
return False
for i in range(2, len(a)):
if a[i] - a[i-1] != q:
return False
return True
ZGVmIGlzQWx0KGEpOgogICAgaWYgbGVuKGEpPD0xOgogICAgICAgIHJldHVybiBGYWxzZQogICAgZm9yIGkgaW4gcmFuZ2UoMSwgbGVuKGEpKzEpOgogICAgICAgIGlmIGFbaV0qYVtpLTFdID4gMDoKICAgICAgICAgICAgcmV0dXJuIEZhbHNlCiAgICAgICAgcmV0dXJuIFRydWUKICAgIAoKZGVmIGlzR3JvdyhhKToKICAgIGlmIGxlbihhKTw9MToKICAgICAgICByZXR1cm4gRmFsc2UKICAgIGZvciBpIGluIHJhbmdlKDEsIGxlbihhKSsxKToKICAgICAgICBpZiBhW2ldIDwgYVtpLTFdOgogICAgICAgICAgICByZXR1cm4gRmFsc2UKICAgICAgICByZXR1cm4gVHJ1ZQoKZGVmIGlzTXVsdGkoYSk6CiAgICBxID0gYVsxXS9hWzBdCiAgICBpZiBsZW4oYSk8PTE6CiAgICAgICAgcmV0dXJuIEZhbHNlCiAgICBmb3IgaSBpbiByYW5nZSgyLCBsZW4oYSkpOgogICAgICAgIGlmIGFbaV0gLyBhW2ktMV0gIT0gcToKICAgICAgICAgICAgcmV0dXJuIEZhbHNlCiAgICByZXR1cm4gVHJ1ZQoKZGVmIGlzQWRkKGEpOgogICAgcSA9IGFbMV0tYVswXQogICAgaWYgbGVuKGEpPD0xOgogICAgICAgIHJldHVybiBGYWxzZQogICAgZm9yIGkgaW4gcmFuZ2UoMiwgbGVuKGEpKToKICAgICAgICBpZiBhW2ldIC0gYVtpLTFdICE9IHE6CiAgICAgICAgICAgIHJldHVybiBGYWxzZQogICAgcmV0dXJuIFRydWU=