Most Difficult Problem Ever

You are given a function like below:

You are given five integers A, B, C, L, R.

You have to calculate the number of integer values of x such that x > 0 and L ≤ F(A, B, C, x) ≤ R.


This is a companion discussion topic for the original entry at https://toph.co/p/most-difficult-problem-ever