Bernard only had durians. Timothy only had apples. They gave each other, half of their fruits. Bernard sold 8 durians and Timothy sold 40 apples. In the end, the ratio of durians to apples for Bernard and Timothy is 1:7 and 1:6 respectively. How many durians did Bernard have at first?