How can I adjust product prices based on variant selection?

Hi Community,
I’ve been trying for days to get the price of my products to increase as the selection increases. We sell metal rails which can be cut to any length. It would now be important that when a customer enters a certain length, that the price also adjusts.
That means the smaller the cheaper and the bigger the more expensive.
A basic price should remain up to a certain length and increase continuously from this limit up to the maximum length.

Our favourite way to enter the lengths would be to simply type in the lengths and not have hundreds of selection fields or a window in which you have to scroll.

Maybe someone can help me?

Thanks in advance!