Madelyn has been saving her earnings from her lemonade stand. Madelyn has 40 dollars to spend. If she buys a new hat for 30 dollars, how many ribbons can she buy with the remaining money if they cost 3 dollars each?