import math
import random

trials = 0
insides = 0

for _ in xrange(10000):
    trials += 1
    a = 2 * math.pi * random.random()
    b = 2 * math.pi * random.random()
    c = 2 * math.pi * random.random()
    x = math.cos(a) + math.cos(b) + math.cos(c)
    y = math.sin(a) + math.sin(b) + math.sin(c)
    if (x ** 2 + y ** 2) ** .5 < 1:
        insides += 1

print float(insides)/trials
