Chef has been in the culinary business for a long time now and with this experience, he wants to expand his profile to a professional food critic. He has been tasting various food items from different cuisines, grading them points and posting them on his blog. The blog is thriving and is gaining a lot of followers who want to take Chef’s recommendation and try out the dishes on their own.
Chef wants to create a paid program to help his readers taste the dishes but he is busy updating his blog so he wants your help.
You are given N dishes, each with base price A and score B. The cost of each food item is the ending digit of AB. Yes, the dishes are cheap, the chef is a real people’s man!
You have to answer Q queries. Each query has a starting index L and an ending index R. In each query you have to determine the total cost of the dishes from L to R (inclusive).
For each query print the total cost of the dishes from L to R (inclusive) in a new line.
The cost of the dishes is 4, 9 and 4, respectively. Query 1 is 4+9 that is 13. Similarly, Query 2 is 9+4 that is 13.