This is a story of a teenager who did something so generous — so big-hearted — that it’s making plenty of adults swoon.

Allan Guei, 18, was a star basketball player at Compton High School in the Los Angeles area before he graduated last month. He also had a GPA above 3.0, and his good grades made him eligible for an unusual competition: A free-throw contest in the Compton High gymnasium. The top prize: $40,000 in scholarship money.

Guei, whose parents immigrated to the United States from the Ivory Coast, knew how much that financial aid could mean for his family. So he was feeling a fair share of pressure as students and teachers crushed into the gym to watch Guei and seven other randomly selected, academically successful students make foul shots.

Guei won the free-throw contest by one basket and netted the $40,000. But it’s what he did next that’s truly astonishing.

‘The right decision’In the weeks following the March free-throw competition, Guei learned that he’d scored a full-ride basketball scholarship to California State University-Northridge. NCAA rules allowed Guei to accept the athletic scholarship and also keep most of the $40,000 he had won.

But Guei couldn’t stop thinking about the seven talented runners-up from the free-throw contest. They, too, had dreams — and very real needs. So, he asked Principal Jesse Jones to make a surprise announcement at Compton High’s graduation ceremony: Guei wanted to donate the $40,000 to the other seven students.

Guei elaborated on his decision to give the money away in an interview with ESPN: “I was already well taken care of to go to school, to go to university for free. ... I felt like they needed it more than I did.”

The beneficiaries of Guei’s generosity were ecstatic.

“It was a shock,” said Omar Guzman, 17, a runner-up who plans to use the money to attend San Diego State University. “I’m really grateful there are people like that out there. It was generous.”

Another of the seven runners-up, Donald Dotson, also plans to start at Cal State Northridge in the fall. Dotson described Guei as “a very deep, intelligent and warm person.”

“He's going to go really far in life,” he said in a statement. “Because of what he’s done for us, God will bless him. That’s what life is all about — stepping forward to help other people.”

Lines that divide — and uniteThe free-throw competition was the idea of Court Crandall, the Hollywood screenwriter behind the movie “Old School” and a partner at a Southern California advertising firm. Crandall was well aware of Compton’s image problems due to gang-related crime. Many of the city’s residents also deal with extreme financial pressures; according to Census data, more than 25 percent of the city’s families live below the poverty line.

One day Crandall was watching his teenage son play basketball with some bright, ambitious Compton students, and he got to thinking about the lines that divide us. Then inspiration struck: Could a free-throw line bring people together?

He decided to create the free-throw scholarship competition and make a stereotype-busting documentary film about the lives of Compton students in the process. Compton’s senior class had about 80 students with a GPA of 3.0 or higher; the eight students who participated in the competition got selected randomly from that group.

Crandall’s advertising firm, Wong, Doody, Crandall, Wiener, raised more than $75,000 for scholarships, making it possible to give $40,000 to the first-place winner and more than $5,000 — enough to cover about a year of college expenses — to each of the seven runners-up.

Now, with Guei’s added generosity, each of those seven runners-up has around $11,000 in scholarship money.

“It was the perfect ending,” Crandall told TODAY.com. “I was ecstatic about how everything turned out. ... Most kids don’t have the sense of composure or leadership that [Allan] does, so after spending time with him and getting to know him, I really wasn’t that surprised by what he did.”