You are quite right: no adverb can never be said to directly "modify" a noun. However, 'exactly' as used here belongs to a class of adverbials known technically as adverbial subjuncts, which serve essentially to focus the referential scope of an adverb on a sentence element other than the verb phrase. Other commonly encountered subjuncts include 'only' and 'mainly'.
The difference begins to become clear when we contrast the same word used as a regular adverbial adjunct, as in
All of the distances had been calculated exactly.
where 'exactly' means 'in an exact way', plainly not the meaning that it has in the sentence at hand (which could, of course, not be rephrased as *for four months in an exact way!).
Another salient difference between the two types is that adjuncts tend to be limited to a small number of possible sentence positions, the choice between which being generally little more than a matter of style/sentence rhythm, with little or no impact on meaning. Thus, the example above could be rephrased as
All of the distances had been exactly calculated.
with no difference at all,
whilst, on the other hand, neither
*All of the distances exactly had been calculated .
nor
*All of the distances had exactly been calculated.
would be acceptable.
Some subjuncts, on the other hand, enjoy considerably greater mobility within the sentence, and the choice of position can often have a major semantic impact, so that e.g.
Only I know what is in the box.
(= No one except me knows this, although I may know many other things.)
differs significantly from
I know only what is in the box.
(= I know nothing except this, although many other people may also know it.)
I started a similar thread two weeks ago or so:
https://www.usingenglish.com/forum/analysing-diagramming-sentences/113237-fun-subjunct-diagrams.html
The position of the subjunct should have set alarm bells ringing. There was still solemn silence. I can't see further than my nose. I am so simple-minded that it hurts at times.
This race, which went on for exactly four months, was the last of its kind.
This is a narrow orientation subjunct that relates to this part of the predication: 'four months'.
This race went on in an exact manner -- adjunct
Philo, let us talk about subjuncts a little, okay?
Two main types, each with subtypes.
Wide orientation subjuncts relate to the whole sentence, but have a particular relationship with the subject. Two subtypes:
- viewpoint subjuncts (largely concerned with the sematic concept of respect):
Looked at grammatically, this sentence is heavy.
- courtesy subjuncts
https://www.usingenglish.com/forum/analysing-diagramming-sentences/113237-fun-subjunct-diagrams.html
kindly = please or = in a kind manner
Narrow orientation
You have consistently opposed my argument. M position of subjunct
Consistently, you have opposed my argument. I position of subjunct(?).
In these sentences, the scope of the reference of 'consistently' is directed towards what? Towrds 'opposed my argument', the whole of the predicate? The corresponding manner adjunct looks like this:
You have opposed my argument consistently.
You have opposed consistently my argument.
- time-relation subjuncts
I have not yet met him. -- Is yet a subjunct here?
I have met him yesterday. -- Adjunct.
Why is yet a subjunct and yesterday an adjunct? :roll:
- emphasisers
I just/simply/really can't believe a word you say.
The word just reinforces effect on the meaning of the sentence. But then, why is it a narrow orientation subjunct? tsssssss :shock:
- intensifiers
I fully appreciate your help.
What does fully do here? It is concerned with the semantic category of degree. It indicates an increase of the intensity with which the predication is expressed.
He practically asked me to leave. -- Decrease in intensity.
He asked me practically to leave.
adjunct
- focusing subjuncts
I merely want to understand subjuncts. -- focus: want to understand subjuncts
Only I want to help you. -- focus: I
I want neither help nor understand you. -- focus: help, understand