Despite facing challenges as a different sort of war movie and an R-rated comedy, both Dunkirk and Girls Trip scored big debut weekends, exceeding expectations en route to the top two spots at the box office.

Dunkirk, a dialogue-light war flick based on a WWII operation that took place in the northern beaches of France, surged to the No. 1 spot at the box office with a projected $50.5 million opening weekend in North America, earning just under $106 million worldwide. Christopher Nolan's latest project is drawing rave reviews for its talented ensemble cast and Nolan's work from the director's chair. It currently holds a 92 percent "fresh" rating on review aggregator Rotten Tomatoes, with an average score of 8.6 out of 10.

The bigger surprise, however, may be the success of Girls Trip, a comedy following Regina Hall, Queen Latifah, Tiffany Haddish, and Jada Pinkett-Smith during an adventure promised by the film's title. Chronicling the group's trip to the Essence Festival in New Orleans, Girls Trip reportedly took in $30.4 million this weekend, the largest opening weekend for a live-action comedy so far in 2017.

Girls Trip had to clear multiple hurdles on its way to success—R-rated comedies have struggled mightily this summer, and Girls Trip's distinction as a female comedy could have, ahem, tripped up the film—but in the end, audiences have responded to the movie.

The stars of the movie were happy to flex a little bit after news of the achievement began to come in, thanking fans for helping turn their movie into a success.

That part!!!!❤️

— Jada Pinkett Smith (@jadapsmith) July 23, 2017

Thank you so much for everyone else showing up and showing out for a Girls Trip! This movie is not to be missed!!!!🤣🤣🤣

— Queen Latifah (@IAMQUEENLATIFAH) July 23, 2017

There's a lesson to be learned from the success of both movies, each of which resonated with fans despite trappings that have limited other films in the genre. If you forget the formulaic nonsense and just focus on putting together a good movie, audiences will reward you.