def gcd(a,b):
    """Calculates Greatest Common Divisor of two integers.
    
    :param a: First integer
    :param b: Second integer
    :returns: Greatest Common Divisor (GCD) of *a* and *b*
    
    Uses `Euclid's algorithm 
    <http://en.wikipedia.org/wiki/Greatest_common_divisor#
    Using_Euclid.27s_algorithm>`_.    
    """
    if(a==b): return a
    if(a== 0): return b
    if(b== 0): return a
    if(a==1 or b==1): return 1
    if(a>b):
        big, small = a, b
    else:
        big, small = b, a
    r = big%small
    while(r != 0):
        big = small
        small = r
        r = big%small
    return small