  The present paper provides a generalization of the previous authors' work on
Bellman functions for integral functionals on $\mathrm{BMO}$. Those Bellman
functions are the minimal locally concave functions on parabolic strips in the
plane. Now we describe the algorithm for constructing minimal locally concave
functions on a planar domain that is a difference of two unbounded convex
domains. This leads to many sharp estimates for functions in the classes like
$\mathrm{BMO}$, $A_p$, or the Gehring classes.
