top=100000 print set([i*(i+1)/2 for i in range(286,top+1)]) & set([i*(3*i-1)/2 for i in range(166,top+1)]) & set([i*(2*i-1) for i in range(144,top+1)])