Variational principle for a three-point boundary value problem