In the case of being uncertain, such as if a person is not sure if he has done something extra or omitted something, e.g., he is not sure whether he has prayed three rak’ahs or four, one of the following two scenarios must apply:
Either he thinks that one or the other is more likely to be case, whether it is doing more or omitting something, in which case he should proceed on the basis of what he thinks is more likely to be the case, complete his prayer accordingly, then do the prostration of forgetfulness after saying the salaam;
Or neither appears more likely to be the case, so he should proceed on the basis of what is certain, namely the lesser amount, and complete his prayer accordingly, then do the prostration of forgetfulness before saying the salaam.