you come local shop want buy chocolate bar there n bar shop ith cost a_i coin want buy themyou m different coupon allow buy chocolate bar ith coupon allow buy q_i chocolate bar pay q_i 1 expensive one cheap bar q_i bar freeyou use coupon use coupon choose q_i bar buy coupon buy remain n q_i bar discountsTo decide coupon choose want know minimum total money pay use coupon optimally