Optimize the given Python code so that it runs more efficiently.
def calculateSum(a, b): 
    total = 0 
    
    for i in range(a,b+1): 
        total += i 
 
    return total
def calculateSum(a, b): 
    return int((b - a + 1) * (a + b) / 2)