BERLIN (AP) — Two Berlin math wizards have solved a problem that confounds many a startup company in the German capital: how to build a popular product and sell it for profit within a few years.

Brothers Maxim and Raphael Nitsche have sold Cogeon, maker of the app Math 42, to California-based education publisher Chegg Inc. in a deal worth at least 12.5 million euros ($15 million).

Chegg said in a statement late Wednesday that the Nitsches, who are in their early 20s, will potentially receive a further 10.7 million euros in cash and stock over the next three years.

The Math 42 app, first launched five years ago, offers personalized, automated training for a subject many students around the world struggle with, and for which there is a billion-dollars tutoring industry.