Taraweeh

Coming late for Taraweeh

Q: When I reached masjid for tarawih, four rakath already finished, then I prayed first four rakath Isha and started for tarawih. When I started to pray for tarawih seven rakath is going on, after finishing tarawih by imam, still I need perform 6 rakath tarawih. In this situation what I need to do, whether I need to pray witr salaa to follow by imam with jamat first and then need to perform balance six rakath tarawih, or first I need to perform balance six rakath tarawih and perform witr salaah alone?