Abu Hurairah reported the Messenger of Allah (ﷺ) as saying:
If anyone obtains a rak'ah in the prayer (along with the imam), he has obtained the whole prayer.