Great Britain in Rio (Getty Images)
Rio de Janeiro - The path to the Olympic podium for British athletes begins with the selection of six numbers.
Every time a Briton fills in a lottery slip and hands over £2, the country moves closer to another Olympic medal.
And medals of every hue are now in the possession of athletes sporting the union jack flag.
It wasn't always like this. The Olympics used to be just like the World Cup for Britain's soccer teams: Stories of near-misses, plucky losers and embarrassment.
But funding from the National Lottery has fueled the transformation of British sports from the nadir of the 1996 Olympics. Britain left Atlanta with a single gold among 15 medals, stranded in 36th place in the standings. Team GB, as it's now known, ranked second in the medals table as the Rio de Janeiro Games entered their final day.
It's been the best games for Britain since 1908, with China squeezed out of second place and only the United States ahead. Jack Laugher and Chris Mears claimed Britain's first-ever diving gold and Max Whitlock became the country's first Olympic gymnastics champion. All 14 British cyclists who competed won medals. The swimmers enjoyed their best games in more than 30 years.
"This is not happening by chance," Simon Timson, performance director at UK Sport, said. "This is success by design. It's the result of 18 years of consistent, coherent and targeted National Lottery investment.
"The partnership we have with the British Olympic Association and the money we've invested into the Team GB's final preparations is one of those elements of success by design."
UK Sport is the government agency that allocates cash from the state and the lottery to Olympic and Paralympic sport.
The lottery was launched in 1994, two years before the debacle of Atlanta left British athletes scurrying back into Britain with no fanfare.
The discussion now is where to hold the victory parade. Manchester in northern England is displacing London for the bus tour this year, a chance to display the gold, silver and bronze medals that have briefly reunited a nation divided by the referendum vote to leave the European Union in June.
It was a British prime minister whose reign was defined at the time by divisions over Europe who created the lottery that spurred the sporting success. John Major's "greatest achievement was to change the face of sport" in the country, IAAF President Sebastian Coe, the double-Olympic middle-distance champion, has said. In the last year, 20 percent of lottery funds were injected into sports.
"The whole idea of the lottery was to create the opportunities for Cinderella sports (where competitors achieve more than expected) to be properly funded and I think by and large it has done well," said David Mellor, who was sports minister in the Major administration in the 1990s.
For Mellor, Whitlock is the type of person "who would have gone to his grave 30 years ago never knowing he had that talent."
Investing in talent searches, facilities and coaching allows Britain to unearth those whose sporting ability never found a competitive outlet. Those who make it into Team GB then benefit from the expertise of the leading coaches and world-class facilities. Before the lottery, many representing Britain had to scrape a living to fund their sporting dreams.
As funding has increased so has Britain's medal haul:
— In the build-up to the 2000 Sydney Games, £58.9 million was invested in 13 sports. Britain finished 10th with 28 medals, including 11 golds.
— Before the 2004 Athens Games, £71 million was invested in 16 sports, producing another 10th place finish but with 30 medals including nine golds.
— Hiking the cash to £235 million across 27 sports, once UK Sport became responsible for investment in development, led to a surge to fourth place in Beijing in 2008. Among 47 medals, 19 were gold.
— Much was focused on a successful London Games in 2012. The athletes justified the £264 million spread across 27 sports by securing third spot ahead of Russia with 65 medals, including 29 golds.
"Most nations invest in two- or four-year projects," Timson said. "We invest in athletes and coaches and support staff in eight-year pathways."
The cash isn't dispersed frivolously. Sports that don't meet pre-games medal targets can have their funding cut.
There is criticism of a system that churns out cash to produce results at the elite level, rather than targeting more handouts at grassroots facilities to boost grassroots participation.
"A relatively small number of sports feature regularly on prime time TV, so for many the Olympic Games is the moment that catapults them onto the screens of the nation," Sport England chief executive Jennie Price said. "We need to capitalize on that."
Britain used to rule through the world through its empire. The former imperial power is showing itself to be a force again internationally - at the Olympics.