I need a conditional sum formula. this is my sheet:

A - B
id - price
1 - 10
2 - 10
3 - 15
4 - 10
4 - 7
4 - 5

I want to calculate the totalsum of id 4. So i want to get the value 22. I searching now for 2 hours and i cant find a possible formula.
Who can help me!

Thnx