Sa'id bin Jubayr said: Whoever enters the mosque when the congregation has already finished should first pray the obligatory prayer.