Laszlo Andraschek had been living on the streets, after debt and unemployment drove him out of his home. However, the 55-year old from Gyor in north-west Hungary, had a few pennies in his pocket, and in an act of hopeless optimism he bought a lottery ticket.
Now he's one of Hungary's biggest lottery winners.
Andraschek kept his winnings quiet after hitting the jackpot in September last year. However, after making a major donation to a homeless shelter he has hit the headlines.
He told The Guardian that he had been on his way to Budapest for a workshop for recovering alcoholics, and while he was at the railway station he decided to spend his last coins on a lottery ticket.
When his numbers came up he told the newspaper that his first move was to pay his debts and those of his relatives. Then he bought a home for each of his three children - and a car. He is also planning to travel to Italy.
The Metro reported that the recovering alcoholic has said he will be careful with the money, and plans to use it to help addicts and abused women.
From homeless to wealthyHe's not the first person to win a life-changing sum when they are down to their last pennies.
The majority of people in this situation say they won't go crazy, but will pay their debts, take care of their family and buy a home - like the homeless former builder who won the lottery in South Carolina in 2012.
However, there are some more unusual stories. There was Dennis Mahurin, who has lived in a tent in Illinois since 1978 and when he won $50,000 on a lottery scratchcard last year said he didn't intend to move - although he might upgrade to a better tent.
In 2007 Wayne D. Johnson, a homeless man from Hartford in the US, found a lost lottery ticket, and won $100,000. He donated $5,000 to a homeless shelter that had helped him and $50,000 to the nuns that ran it. He also started volunteering at the shelter.
In 1989 in France a homeless man won 70,000 francs and was told he needed a bank account to put the money in. He remembered he had an old account and told the lottery officials about it - at which point they discovered that he already had more than 200,000 francs in the account that he'd forgotten about.
However, for some people the transformation works the other way around. Michael Carroll, the lottery winner who referred to himself as 'King of Chavs' after winning the money in 2002, lost it all through reckless spending. Since then he has gone through many ups and downs, and in January this year was reportedly living in a hostel for the homeless in Inverness.