Edit the following Python program to optimize its speed.
# This program to calculate sum of first n numbers
def sumN(n): 
    sum=0
    for i in range(1,n+1): 
        sum=sum+i

    return sum

print(sumN(100))
# This program to calculate sum of first n numbers
def sumN(n): 
    sum = n * (n + 1) // 2
    return sum

print(sumN(100))