===INPUT=== 500 100 150 ===OUTPUT=== 350570 ===END===