At first, the ratio of Dave's savings to Sam's savings was 5:4. After each of them donated $40 to charity, the ratio of Dave's savings to Sam's savings became 13:10. What was Dave's savings at first?