Arby's got its hat back — but it cost them a pretty penny. The restaurant chain put up more than $40,000 to buy Pharrell Williams' now-infamous Grammys topper in a charity auction on Sunday, March 2, the day of the 2014 Oscars.

"Thank you to whoever bought my Grammy hat on @eBay for $44,100," Williams tweeted shortly before taking the stage at L.A.'s Dolby Theatre to perform his Academy Award-nominated hit, "Happy," from Despicable Me 2. "Your donation benefits From One Hand to AnOTHER." (From One Hand to Another is Williams' charity for at-risk youths.)

Arby's then replied to the star's tweet, writing, "@Pharrell, you're welcome. We're HAPPY to support a great cause & get our hat back. Good luck at the #Oscars tonight!"

The "Get Lucky" singer's interaction with the fast food sandwich company first began back in January, when he wore Vivienne Westwood's oversized "Mountain" hat to the Grammys. "Hey @Pharrell, can we have our hat back?" the chain tweeted at the time, to which he replied, "Y'all tryna start a roast beef?"

Since then, the hat — which retails for $180 — has become something of a signature for Williams. He even wore a version of it when he performed at Sunday's Oscars ceremony, where he danced with the likes of Lupita Nyong'o, Meryl Streep, and Amy Adams.