hit-me-baby-one-more-time

The Enigma crew came to know some of the location where the bombs are planted. So they started to find the code through which they can diffuse the bombs .Each bomb has different code for diffusion. The crew found the solution the diffusion code is between the ranges 1 to N-1 where N is the integer value. The summation of the multiple of 3 or 5 within the range give the diffusion code.

Input Format
It contain the integer N.

Output Format
Print an integer that denotes the sum of all the multiples of 3 or 5 below N.

Constraints
1 ≤ N ≤ 10000000000

SAMPLE INPUT
10

SAMPLE OUTPUT
23

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
def ap(n):
	return (n*(n+1)/2)

x=int(input())
print((ap((x-1)/3)*3+ap((x-1)/5)*5-ap((x-1)/15)*15))


def f(n):
	return n*(n+1)/2

a=int(input())
a=a-1
print(f(a/3)*3+f(a/5)*5-f(a/15)*15)


__author__ = 'root'

# def solve(n):
#     count = 0
#     for i in xrange(1, n):
#         if i%3== 0 or i % 5 == 0:
#             count += i
#     return count

def summ(x):
	return (x * (x + 1))/2

n = eval(input())
count = 0
x = (n-1)/5
y = summ(x)
y *= 5
count += y
x = (n-1)/3
y = summ(x)
y *= 3
count += y

#print count
to_ded  = (n-1)/15
print((count - (summ(to_ded) * 15)))
# 
# print solve(n)


def f(n,a):
	k=n/a
	return (a*k*(k+1))/2

n=int(input())
n-=1
ans=f(n,3)+f(n,5)-f(n,15)
print(ans)


n= eval(input())
k1=(n-1)/3
k2=(n-1)/5
k3=(n-1)/15
#print k1,k2,k3
ans=((k1*(6+(k1-1)*3))+(k2*(10+(k2-1)*5))-(k3*(30+(k3-1)*15)))/2
print(ans)


def sum35c(n):
	'Sum the arithmetic progressions: sum3 + sum5 - sum15'
	consts = (3, 5, 15)
	# Note: stop at n-1
	divs = [(n-1) // c for c in consts]
	sums = [d*c*(1+d)/2 for d,c in zip(divs, consts)]
	return sums[0] + sums[1] - sums[2]

if __name__=='__main__':
	n = int(input())
	print(int(sum35c(n)))


n = int(input())
n=n-1
rem = n%5
n5 = n-rem
rem = n%15
n15 = n-rem
rem=n%3
n3=n-rem
not15=n15/15
not5=n5/5
not3=n3/3
s = not3*(3+n3)+not5*(5+n5) - not15*(15+n15)
print(s//2)