40. Misha paid at the cafeteria cash register for 3 dishes, and Sasha - for 2 (all dishes at the same price). At the table, Grisha joined them, and the three of them ate 5 dishes. During the settlement, it turned out that Grisha should pay his friends 50 k. How much of this amount should he give to Misha and how much to Sasha, if each of them should contribute the same amount?
40. Grisha paid $\frac{1}{3}$ of the cost of all dishes, which is 50 k. Therefore, the cost of all dishes is $50 \cdot 3=150$ (k.), and one dish costs 30 k. ($150: 5=30$). Misha paid $30 \cdot 3=90$ (k.), and Sasha - 60 k. Therefore, Grisha should give Misha 40 k. $(90-50=40)$, and Sasha 10 k. $(60-50=10)$.