Mrs. Henry opened a bag of sugar. She poured 1,500 grams of sugar into 5 beakers and 500 grams of sugar into 4 beakers. She had 500 grams left over. What was the mass of the bag of sugar in kilograms before Mrs. Henry opened it?