Description

Mileage program of ACM (Airline of Charming Merlion) is really nice for the travelers flying frequently. Once you complete a flight with ACM, you can earn ACMPerk miles in your ACM Mileage Bank depended on mileage you actual fly. In addition, you can use the ACMPerk mileage in your Mileage Bank to exchange free flight ticket of ACM in future.

The following table helps you calculate how many ACMPerk miles you can earn when you fly on ACM.

When you fly ACM		 Class Code	          You'll earn

First Class			 F		 Actual mileage + 100% mileage Bonus

Business Class		   	 B		 Actual mileage + 50% mileage Bonus

Economy Class			 Y

1-500 miles 500 miles

500+ miles Actual mileage

It's shown that your ACMPerk mileage consists of two parts. One is your actual flight mileage (the minimum ACMPerk mileage for Economy Class for one flight is 500 miles), the other is the mileage bonus (its accuracy is up to 1 mile) when you fly in Business Class and First Class. For example, you can earn 1329 ACMPerk miles, 1994 ACMPerk miles and 2658 ACMPerk miles for Y, B or F class respectively for the fly from Beijing to Tokyo (the actual mileage between Beijing and Tokyo is 1329 miles). When you fly from Shanghai to Wuhan, you can earn ACMPerk 500 miles for economy class and ACMPerk 650 miles for business class (the actual mileage between Shanghai and Wuhan is 433 miles).

Your task is to help ACM build a program for automatic calculation of ACMPerk mileage.

Input

The input file contains several data cases. Each case has many flight records, each per line. The flight record is in the following format:

OriginalCity DistanceCity ActualMiles ClassCode

Each case ends with a line of one zero.

A line of one # presents the end of the input file.

Output

Output the summary of ACMPerk mileages for each test case, one per line.

Sample Input

Beijing Tokyo 1329 F
Shanghai Wuhan 433 Y
0
#

Sample Output

3158

Hint

When calculate bonus ,be sure you rounded x.5 up to x+1

POJ1326问题描述的更多相关文章

  1. [内核笔记1]内核文件结构与缓存——inode和对应描述

    由来:公司内部外网记录日志的方式现在都是通过Nginx模块收到数据发送到系统消息队列,然后由另外一个进程来从消息队列读取然后写回磁盘这样的操作,尽量的减少Nginx的阻塞. 但是由于System/V消 ...

  2. PhpStorm和WAMP配置调试参数,问题描述Error. Interpreter is not specified or invalid. Press “Fix” to edit your project configuration.

    PhpStorm和WAMP配置调试参数 问题描述: Error. Interpreter is not specified or invalid. Press “Fix” to edit your p ...

  3. 杂项之python描述符协议

    杂项之python描述符协议 本节内容 由来 描述符协议概念 类的静态方法及类方法实现原理 类作为装饰器使用 1. 由来 闲来无事去看了看django中的内置分页方法,发现里面用到了类作为装饰器来使用 ...

  4. ASP.NET MVC 描述类型(二)

    ASP.NET MVC 描述类型(二) 前言 上个篇幅中说到ControllerDescriptor类型的由来过程,对于ControllerDescriptor类型来言ActionDescriptor ...

  5. ASP.NET MVC 描述类型(一)

    ASP.NET MVC 描述类型(一) 前言 在前面的好多篇幅中都有提到过ControllerDescriptor类型,并且在ASP.NET MVC 过滤器(一)篇幅中简单的描述过,今天我们就来讲一下 ...

  6. python描述符理解

    Python中的描述符是一个相对底层的概念 descriptor Any object which defines the methods get(), set(), or delete(). Whe ...

  7. 网站实现微信登录之回调函数中登录逻辑的处理--基于yii2开发的描述

    上一篇文章网站实现微信登录之嵌入二维码中描述了如何在自己的登录页面内嵌入登录二维码,今天的这篇文章主要是描述下在扫码成功之后微信重定向回网站后登录逻辑的处理,其实也就是验证身份信息,授权用户登录的逻辑 ...

  8. 网站实现微信登录之嵌入二维码——基于yii2开发的描述

    之前写了一篇yii2获取登录前的页面url地址的文章,然后发现自己对于网站实现微信扫码登录功能的实现不是很熟悉,所以,我会写2-3篇的文章来描述下一个站点如何实现微信扫码登录的功能,来复习下微信扫码登 ...

  9. 深入学习jQuery描述文本内容的3个方法

    × 目录 [1]html() [2]text() [3]val()[4]总结 前面的话 在javascript中,描述元素内容有5个属性,分别是innerHTML.outerHTML.innerTex ...

随机推荐

  1. ibatis插入数据返回ID的方法

    ibatis插入数据返回ID的方法 主要就是利用seelctkey来获取这个ID值,但是oracle和mysql的区别还是很大的 oracle的用法 <insert id="inser ...

  2. dtd语法之定义属性

    1.语法: <!ATTLIST 元素名称 属性名称 属性类型 默认值>  属性类型: l CDATA :文本数据 l (en1|en2|……) :属性值任选其一 l ID :属性值必须是唯 ...

  3. CVE-2013-3908 Internet Explorer打印预览功能可导致信息泄露

    原文:http://masatokinugawa.l0.cm/2014/11/ie-printpreview-infoleak.html 问题1: 在IE9和以前的版本当中进行打印预览操作时,IE会取 ...

  4. Html - 横版TH+TD

    通常可位于表格上方的搜索区域html <div class="panel panel-default"> <div class="panel-body& ...

  5. CSS3动画(动画已丢,看原文)

    原文:http://ued.1905.com:8880/sample/css3/base/test.html CSS3动画 简要展示了CSS3常用动画效果,以及所使用代码. bounce 复制 展开代 ...

  6. CSS权威指南 - 浮动和定位 1

    定位 定位的想法很简单元素框相对于正常位置出现在哪里. 定位:static,相对, 绝对, fixed, 继承 static就是默认的位置 相对就是相对于默认位置的偏移.原来的static定位位置依然 ...

  7. [Albert 朗读行动记录贴]采纳Scalers方法:口语成长行动

    目标:100小时成长计划,持续朗读录音100小时. 行动计划:每天点评美音3个人的朗读,英音1个. 完成朗读计划,录一段.附录一段.1分半左右. 开始日期:3月18日 原帖: [335][合辑]Sca ...

  8. centos7 设置中文

    查看系统版本[root@webtest76 ~]# cat /etc/redhat-releaseCentOS Linux release 7.0.1406 (Core) [root@localhos ...

  9. centos时间同步方法

    centos时间同步方法 电脑软硬件应用网 45IT.COM 时间:2012-12-08 18:09 作者:李本清 新装的服务器可能设置了错误的,需要调整时区并调整时间.如下是使用NTP来从一个时间服 ...

  10. Maximum Likelihood

    https://en.wikipedia.org/wiki/Maximum_likelihood_estimation http://mathworld.wolfram.com/MaximumLike ...