Responder 1st bids. Responding to a preempt
Your partner is weak,with an opening bid of 3 in a suit. He will have calculated as follows, you hope:
"I can afford to go down 3 if I'm not vulnerable.
"Assuming no help whatsoever from my partner, I will therefore need to have 6 winners in my hand in order to bid 3. I have 7 trumps... so let's hope he has an average number of the remaining 6 trumps, i.e. at least 2. (To preempt at the 4-level, the same considerations apply, except that I need an extra trump, an 8-card suit).
"My partner, having both 2 trumps and enough power overall to win 3 tricks, will breathe a sigh of relief and say 'no bid'. If partner has more power than this, he will increase the bidding accordingly, with the result that he might even raise to game.
"If I am vulnerable, I should take less risk: I need to see 7 winners, not 6, in order to bid. In other words, partner is only required to make up a difference of 2. Partner will know this, and only need two tricks in his hand to breathe easily, or three tricks to raise me one."
So it's easy. That's what you do.
Responding to a preempt made in the second seat
You're in the 4th seat, partner preempted in the second seat and should have a stronger hand. He'll have 2 of the top 3 honours.
If therefore you have one of them, and stoppers in all the other suits, bid 3NT. You can count on 7 tricks in the long suit, and you only need 2 more from the stopped outside suits.
But beware 3NT….you may have to lead from hand a lot of the time, so your stoppers may need to be good. However, with a solid two out of three top trumps in dummy, you should be OK.