The boos continued, and so did Daniil Medvedev’s U.S. Open run. The fifth-ranked Russian, the villain of the tournament, will take that trade-off.

He reached his first-ever Grand Slam quarterfinal Sunday night and didn’t mind how he has been received by the Flushing fans. After the winning point, he danced, further angering the crowd. As he did Friday night, Medvedev egged the fans on in his on-court interview, thanking them for motivating him with their jeers.

“After the match, I engaged a little bit with the crowd,” Medvedev said after topping Dominik Koepfer, 3-6, 6-3, 6-2, 7-6 (2), at Louis Armstrong Stadium, advancing to face No. 23 Stan Wawrinka. “But we all know how [the] New York crowd can be. It’s probably the most electric crowd in the world, I think. Especially, I mean, playing this week on big courts, I could feel it. Today I was just engaging with the crowd and hopefully — hopefully it was fun for them and for me. As I said, it gave me a lot of energy to win.”

His villainous role began Friday night, when Medvedev admitted he acted like an “idiot.” In the first set of his victory over Feliciano Lopez, he ripped a towel from a ball person’s hands, drawing a code violation, threw his racket in the direction of the chair umpire and was seen on the big screen flashing his middle finger by the side of his head.

“I did some things that I’m not proud of and that I’m working on to be a better person on the court because I do think I’m a good person out of the court,” he said.

He was on better behavior Sunday, but the crowd wasn’t forgiving, rooting on the unseeded Koepfer. The German took the first set, but Medvedev responded by winning the next three. He saved 10 of 14 break points and converted six of 10, taking advantage of Koepfer’s 51 unforced errors.

Two years ago, Madison Keys reached the final here, topping Elina Svitolina in the fourth round along the way. The fifth seed got revenge, whipping Keys in straight sets, 7-5, 6-4, at Arthur Ashe Stadium to advance to a quarterfinal matchup with No. 16 Johanna Konta.

Keys, the 10th seed, couldn’t solve Svitolina’s serve, failing to earn a break-point opportunity in the 75-minute match, as her career-best nine-match winning streak came to an end.

“It’s tough to win a match when that’s going on,” Keys said. “It’s hard to win a match when you’re not making a lot of returns and being able to even put any pressure on her serve.”

It started well for David Goffin, but went downhill — fast. After breaking Roger Federer’s serve in the third game of the match, Goffin proceeded to get pancaked by the 20-time Grand Slam winner, who cruised to a 6-2, 6-2, 6-0 win in the fourth round at Arthur Ashe Stadium.