Prediction of stability constants. I. Protonation constants of carboxylates and formation constants of their complexes with class a metal ions