In [17]:
def compute_posisum(end):
    i=1
    total=0
    while i<end:
        i=i+4
        total=total+1/i
    return total

def compute_negasum(end):
    i=3
    total=0
    while i<end:
        i=i+4
        total=total+1/i;
    return total

n=int(input('plz enter an integer,end with a tab: '))
sum=0
sum=compute_posisum(n/2)-compute_negasum(n/2)
print(4*sum)


plz enter an integer,end with a tab: 1000
0.470957748576633