fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6. int n,m,a,b;
  7.  
  8. cin>>n>>m>>a>>b;
  9.  
  10. int price=(n*3-m)*a+b;
  11.  
  12. if(price<0)
  13. cout<<0;
  14. else
  15. cout<<price;
  16.  
  17.  
  18. return 0;
  19. }
Success #stdin #stdout 0.01s 5288KB
stdin
1 8 8 5
stdout
Standard output is empty