The secret organization YouDontSeeUs has many secrets that must be kept away from curious and dangerous eyes. Although the less people know secrets the better, in order to avoid a secret dying with its guardian, each secret must be known by several reliable people; so HugeHead, the organization highest authority member, put up an ingenious scheme to divide the task of secrets keeping.
HugeHead distributes copies of part of the organization secrets among each one of YouDontSeeUs’ BigHeads. Each one of these BigHeads copies part of the secrets he received, and distributes those copies among the members of his Circle of Truth; on their turn, each member of this Circle of Truth copies part of the secrets he received, and distributes those copies among the members of his own Circle of Truth, and so on.
All Circles of Truth in the hierarchy of a given BigHead b have the same number of members, here denoted by Nb.
Each Circle of Truth leader in the hierarchy of b (including b himself) divides the X secrets he receives in Nb + 1 equal parts. He then makes a copy of the secrets in Nb of these Nb + 1 parts, and divides those copies among the Nb members of his Circle. The number of secrets a BigHead b receives from the HugeHead is such that this divison process is guaranteed to end at the same step for all the branches determined by the process – the last step is such that all members of each last Circle of Truth are given one and only one secret.
As an example, consider BigHead Johnny, who received 16 secrets from the HugeHead. Because all Circles of Truth in Johnny’s hierarchy have 3 members, Johnny makes one copy of 12 of those 16 secrets and gives 4 of them to each member of his Circle of Truth. Then, each one of these members makes one copy of 3 of the 4 secrets he received, and gives 1 of them to each member of his own Circle of Truth. The process stops here because all members of these last Circles of Truth were given only one secret. In the end, there are 9 members that know exactly one secret, 4 members that know more than one secret, and there are 37 copies of the original secrets (including the ones given to Johnny).
Your task, should you choose to accept it, involves finding, in a given BigHead hierarchy, the number of YouDontSeeUs’ members that know more than one secret, and the number of existing copies of the original secrets.
As always, should any member of your team be caught or killed, the TIUP organization will disavow all knowledge of your actions.
The first line of the input contains a positive integer (S) denoting the number of secrets a BigHead received. The second line of the input contains a positive integer (M) denoting the number of members, in the final Circles of Truth initiating in that BigHead, that know exactly one secret.
|•||2 ≤ S ≤ 109||Number of secrets BigHead received|
|•||1 ≤ M ≤ 109||Number of members that know exactly one secret|
The first line of the output is the total number of members, in the hierarchy of the BigHead, that know more than one secret (including the BigHead).
The second line of the output is the total number of copies of the secrets given to that BigHead (including the ones given to the BigHead).