Romanian economist Stefan Mandel was struggling to make ends meet.
So he came up with an unlikely solution — winning the lottery.
But while most people who dream of scooping the jackpot rely on dumb luck, Mr Mandel had other ideas.
The maths whiz spent his spare time poring over probability papers penned by mathematician Leonardo Fibonacci — and after years of painstaking research, he devised a "number-picking algorithm" which drew on a method he called "combinatorial condensation".
Under that method, Mr Mandel boasted he could predict five out of six winning numbers — a feat which reduced the number of possible winning combinations down to thousands instead of millions.
Along with a group of friends, he bought huge amounts of tickets using all the possible combinations and ended up taking out the top prize — worth over $A26,000.
After paying expenses, he was left with just $A5400, but it was more than enough to bribe officials and escape Romania's Communist system, and move to Australia to start a new life with his wife and two kids.
But his lotto racket was just getting started — and unlike notorious US lotto scammer Eddie Tipton, Mr Mandel eventually won the lottery 14 times without breaking a single law.
Once the family was settled in Australia, Mr Mandel realised that in some draws, the total cost of buying a ticket to play every possible combination was much lower than the grand jackpot prize.
For example, if a game required six numbers ranging between 1 and 40 to be chosen, there would be 3,838,380 possible number combinations, The Hustle reported.
If the jackpot was $10 million, and tickets cost $1 each, Mr Mandel still stood to win a massive profit.
Of course, he still had a few hurdles to overcome — raising capital to cover the cost of the tickets in the first place, and how to physically fill in every single form.
But while working as an insurance agent by day, Mr Mandel persuaded a pool of investors to put their cash together to build a lotto syndicate.
He also invented an automation system, with printers and computers using the algorithm to fill out tickets automatically using every combination of numbers.
During the 1980s, the syndicate waited until a jackpot grew to be bigger than the total combinations, before snapping up thousands of tickets.
The group won 12 lotteries and won hundreds of thousands of smaller prizes across Australia and the UK.
But again, there were setbacks: profits weren't high enough, and Aussie lotto authorities were also cottoning onto the plot, eventually changing the rules to ban computer-printed forms and bulk buying tickets in a bid to thwart the syndicate.
But Mr Mandel still had an audacious plan B up his sleeve.
With the profits he'd already made, he planted scouts across the US and also developed a list of previous lotteries with jackpots that were at least three times higher than the total of all possible combinations.
He set his sights on the Virginia Lottery, as its numbers only ranged between one and 44, which meant the total number of possible combinations was millions lower than in other games.
He set up an official company, Pacific Financial Resources, and under it also developed a trust called the International Lotto Fund.
He persuaded thousands of investors to pour cash into the fund, raising millions in the process.
In February 1992, the Virginia Lottery reached a jackpot of $US27 million.
Mr Mandel had already set up shop in a warehouse in Melbourne and employed 16 full-time staff to print out seven million tickets over three months, which he then mailed to an associate in the US.
The syndicate won the lot, along with a further $US900,000 in secondary prizes.
But while Mr Mandel's method was not illegal, it still raised suspicions, and he was dragged into a four-year legal battle.
During that time he was investigated by countless international agencies including the CIA, FBI and the Australian Securities and Investments Commission.
He was eventually cleared of any wrongdoing — but while Mr Mandel managed to pocket millions from the win, his investors only received $US1400 of their $US4000 investment — a far cry from the wealth they had been promised.
Mr Mandel filed for bankruptcy in 1995 and at one point spent 20 months behind bars in Israel thanks to an investment scam.
These days, he leads a quiet life in Vanuatu, away from the spotlight, although all US states have since passed laws banning the use of Mr Mandel's strategy.
But despite his epic gamble, Mr Mandel downplayed the risks he had faced during a 2012 interview with the Romanian newspaper, Bursa.
"I'm a man who takes risks, but in a calculated way," he told the publication.
"Trimming my beard is a lottery: There is always the possibility that I'll cut myself, get an infection in my blood and die — but I do it anyway.
"The chances are in my favour."