//Intermediate 3

//St.Stanislav Institution

//Author: Žiga Gradišar

 

 

 

 

#include <iostream>

#include <iomanip>

#include <ctype.h>

#include <stdio.h>

#include <math.h>

using namespace std;

 

// ne pozabi system pause!!

 

 

double resi(double a, double b,  double d){

      double r=0;

      if(a>99 and a<200){

            if(b>5){r+=5*10;b-=5;r+=b*15;}

            else r+=b*10;

      }

      if(a>199 and a<300){

            if(b>6){r+=6*7.5;b-=6;r+=b*15;}

            else r+=b*7.5;

      }

      if(a>299 and a<400){

            if(b>4){r+=4*9.25;b-=4;r+=b*10.5;}

            else r+=b*9.25;

      }

      if(a>399 and a<500){

            if(d==1 or d==7)r+=b*13.5;

            else r+=b*6.75;

      }

      if(a>499 and a<600){

            if(b>6){r+=6*8;b-=6;r+=b*12;}

            else r+=b*8;

      }

      return r;

}

 

 

int main(){

     

 

 

      cout<<"Prosim pisite brez vejic! Input should not contain commas!"<<endl;

      for(int i (0);i!=5;++i){

            cout<<i+1<<". ";

            double r=0;

            double stevilo, dan, t1, t2;

            char cas1, cas2;

            cin>>stevilo>>dan>>cas1>>cas2;

            if(isalpha(cas1))t1=cas1-65+10;

            else t1=cas1-48;

            if(isalpha(cas2))t2=cas2-65+10;

            else t2=cas2-48;

            r+=resi(stevilo, (t2-t1)/2, dan);

           

            cin>>stevilo>>dan>>cas1>>cas2;

            if(isalpha(cas1))t1=cas1-65+10;

            else t1=cas1-48;

            if(isalpha(cas2))t2=cas2-65+10;

            else t2=cas2-48;

            r+=resi(stevilo, (t2-t1)/2, dan);

            r = floorf(r * 100 + 0.5) / 100;

            cout<<fixed;

            cout<<i+1<<". answer: " <<"$";

            cout<<setprecision(2)<<r;

            cout<<endl;

      }

     

      cin.get();cin.get();

}