def gcd(*args):
    """Return the greatest common divisor of input integers."""
    # Return self if a single number is passed
    if len(args) == 1:
        return args[0]
    # Pairwise case
    elif len(args) == 2:
        a, b = args
        if a < 0: a = -a
        if b < 0: b = -b
        while(b != 0):
            tmp = b
            b = a % b
            a = tmp
        return a
    # If greater than two arguments, recurse
    a = args[0]
    b = gcd(*args[1:])
    return gcd(a, b)