某快递公司,寄快递根据重量w收费: w < 5时 5元/kg, 5 \le w< 10时 4元/kg, 10 \le w < 15时 3元/kg, w \ge 15时 2元/kg 不足1kg的也按1kg计算,小明现在要寄w千克的物品,请您编写程序帮他计算应该付多少钱。