#include <stdio.h>
float count_discount(int x, float y,float pay)
{
double sum;
if (y<(200/8.38))
{
sum = y * 0.3;// 每升优惠3毛
if (x == 5) // 星期五每升额外优惠1毛
sum += y * 0.1;
}
else if (y==(200/8.38))
{
sum = 0;
}
else
{
y = y - (200 / 8.38);
sum = y * 0.3;// 每升优惠3毛
if (x == 5) // 星期五每升额外优惠1毛
sum += y * 0.1;
}
sum = (int)(sum*100.0 + 0.5) / 100.0;
return sum;
}
float coupondiscount(float a)
{
if (a>=200)
{
return 20;
}
else
{
return 0;
}
}
int main()
{
int t, x;
float y;
float pay, discount;
scanf("%d", &t);
while (t--)
{
scanf("%d", &x);
scanf("%f", &y);
pay =(int)((8.38 * y)*100+0.5)/100.0;
discount = count_discount(x, y,pay);
if (pay >= 200)
pay -= 20;
pay = pay - discount;
printf("Order amount: %.2f\n", (int)(8.38 * y*100.0+0.5)/100.0);
printf("E-coupon discount amount: %.2f\n", coupondiscount((int)((8.38 * y) * 100 + 0.5) / 100.0));
printf("Discount amount: %.2f\nPayment amount: %.2f\n", discount, pay);
}
return 0;
}