Andrew discovered a buried treasure box he opened it up and found that it contained 682 duo manda and 117 rubies he sold 45 gems and bought 130 gems how many gems does he have now?