Upvote:1
In general, you are entitled to a refund of any fare, taxes and fees associated with any cancelled segment for which you are not reaccommodated.
Important, this only applies when the carrier cancels the flight. If you cancel or miss, a whole different set of rules apply.
There's nothing really to 'calculate'. Each segment has an associated fare which is set at the time of booking. The fare has nothing to do with distance and nothing to do with how other itineraries with that segment are priced.
Meaning, even if AZ sold that exact same flight on it's own for €900, the fare for your itinerary might be only €28 and you would be entitled to only €28 + taxes and fees.