def pgcd_1(a, b):
    """
    Stein algorithm
    :param a: input 1
    :param b: input 2
    :return: the PGCD of a and b
    """
    if a == b:
        return a
    if (a & 1) == 0 and (b & 1) == 0:
        return pgcd_1(a >> 1, b >> 1) << 1
    elif (a & 1) == 0 and (b & 1) != 0:
        return pgcd_1(a >> 1, b)
    elif (a & 1) != 0 and (b & 1) == 0:
        return pgcd_1(a, b >> 1)
    else:
        big = max(a, b)
        small = min(a, b)
        return pgcd_1(big - small, small)