Habits and goals in synergy: a variational Bayesian framework for behavior