
sages and math puzzle

Hello dear people.
I want to offer you a rather interesting puzzle, I myself came across it for a long time in an echo of a puzzle, and since then I have not seen it either in my personal life or on the open spaces of Runet. Search on a habr also did not bring result.
Therefore, I offer it to your community in the form in which he himself first read it.
TWO WISES
Some sultan had two sages: Ali-ibn-Wali and Wali-ibn-Ali. Wanting to be convinced of their wisdom, the sultan called the sages to himself and said: "I conceived two numbers. Both of them are integer, each is larger units, but less than a hundred. I multiplied these numbers and I will report the result Ali and at the same time Vali I will say the sum of these numbers. If you really are as wise as they say about you, you can find out original numbers. " The sages thought. Ali was the first to break the silence. “I don't know these numbers,” he said, bowing his head. “I knew that,” Vali said. “Then I know these numbers,” Ali rejoiced. - Then I know! - exclaimed Vali. And the sages informed the defeated king of the numbers he had conceived. Define them, too, you reader.
I want to add on my own that it is quite possible to guess these numbers, but the proof of the uniqueness of the solution is not a trivial task and it has a lot of routine and mathematics.
I would like to publish this puzzle in the “entertaining tasks” section, but I don’t have enough karma.
oh yes, as it is customary to say: this is my first post on the hub, therefore I apologize for possible violations%)
upd: Attention! comments already have an answer.
upd2: as prompted in comments, this task was on the brahames.
upd3: well, the most complete answer that I know here