#include<iostream>
using namespace std;

int main(){
	
	int code, totalUnit, totalPay;
	
	cout<<"User code : 1.Household  , 2.Office  , 3.Factory  , 4.End program"<<endl;
	cout<<"Please enter code :  "<<endl;
	cin>>code;
	
	if (code>0 && code<4)
	{
	 cout<<"Please enter consumption totalUnit :    "<<endl;
	 cin>>totalUnit; 
	 if (code=1)
	 {
	   if (totalUnit<=500)
	    totalPay=totalUnit*0.10;
	    if (code=2)
	     {
	      if (totalUnit<=1000)
	       {
           totalPay = totalUnit*0.25;
           if (code=3)
            
            if (totalUnit<=1500)
            totalPay=totalUnit*0.50;
            else 
            totalPay=(1500*0.50)+(totalUnit-1500)*0.75;
            
           }
          else 
          {
		   totalPay=(1000*0.25)+(totalUnit-1000)*0.50;   
            if (code=3)
            
             if (totalUnit<=1500)
              totalPay=totalUnit*0.50;
          }
         }
         else 
         {
         if (code=3)
            
          if (totalUnit<=1500)
           totalPay=totalUnit*0.50; 
           
          else
           totalPay=(1500*0.50)+(totalUnit-1500)*0.75;
           
         }
       else 
	   {
	   totalPay=(500*0.10)+(totalUnit-500)*0.25
	    if (code=2)
	      
	      if (totalUnit<=1000)
           totalPay = totalUnit*0.25;
            
            if (code=3)
            
             if (totalUnit<=1500)
              totalPay=totalUnit*0.50;  
       }
      }
      else 
      if (code=2)
	  {   
	   if (totalUnit<=1000)
	   {
        totalPay = totalUnit*0.25;
            
            if (code=3)
            {
             if (totalUnit<=1500)
             {
              totalPay=totalUnit*0.50;
              end if;
             }
             else
             {
             totalPay=(1000*0.25)+(totalUnit-1000)*0.50;
             end else;
             }
            }
            else
            end else;
       }
       else 
       {
       totalPay=(1000*0.25)+(totalUnit-1000)*0.50
       if (code=3)
            {
             if (totalUnit<=1500)
             {
              totalPay=totalUnit*0.50;
              end if;
             }
             else
             {
             totalPay=(1000*0.25)+(totalUnit-1000)*0.50;
             end else;
             }
            }
            else
            end else;
       }
       }
      else 
      if (code=3)
       {   
       if (totalUnit<=1500)
        totalPay=totalUnit*0.50;
        end if;
       else
       totalPay=(1500*0.50)+(totalUnit-1500)*0.75;
       end else;
       }
      else
      end else;
     
    
	else 
	 {
	 if (code=4)
	  {
	   cout<<"Program is ended."<<endl;
	   end if
      }
	 else
	  end else 
     }
	

	return 0;
}
