adding mathematical rules in a collection field

Hey all,
I was wondering to implement a feature somehow using code. I do have a booking form where I have added some calculations rules to calculate the cost of booking as per user input in the form and at the last of the page, total cost is displayed which is later paid using stripe by the user. But I wanted to store that calculated cost in my data collection field so that I can check it in future just for my personal business use.

So here is an example to understand this request:
There is a dropdown field with numbers of people going in the trip. And each person’s cost is 3000$ which is already displayed in the form as normal text to notify the customer. Now if customer select more than one person from the people’s dropdown field then selected number is automatically multiplied by per person’s cost

Selected number of person (2) x Per Person’s Cost($3000) = $6000 (Total Payable Amount)

Now this total payable amount should be stored to data collection field automatically when customer make the payment. So is there a way to save it. because I tried it using some codes that I know but they all didn’t work.

It is not mandatory that this calculation gets completed within the form, We can alternatively do calculate this within the data collection field where we simply can apply some codes in backend area that first calculate the number of peoples and total cost and then stores the final value to data collection.

Please help me if somebody has any solution.