Variational problems for functionals involving the value distribution