OPINION OF THE COURT
Acosta, J.The issue in this case is the meaning of the parties’ ATM placement agreement, which provides the particulars of compensation by defendant, an ATM company, to plaintiff, a drugstore chain, upon “branding” the ATMs with a major bank (JPMorgan Chase) and changing the previous payment structure such that Chase customers would not be required to pay a surcharge fee. We hold that the language of the agreement is ambiguous, and we therefore remand for trial.
In 1999, American Express Travel Related Services Company (Amexco) entered into a contract with plaintiff for the placement of Amexco’s ATMs in plaintiffs stores. Two years later they amended the contract. Thereafter, in August 2003, with plaintiffs consent, Amexco transferred and assigned all of its rights, duties and obligations under the contract to defendant. Four months later, the parties further amended the contract, modifying several sections and adding new ones. This second amendment extended the life of the contract through 2014, and expanded the placement of ATMs from the originally agreed-upon six locations in the center of commercial midtown Manhattan to roughly 200 locations across the greater New York metropolitan area.
The second contract amendment also included a provision, paragraph 11 (a), concerning “Bank Branding,” which is at the center of this dispute:
*139“Both parties acknowledge that a ‘Bank Branding’ arrangement with a large well-known financial institution (a ‘bank’) covering and affecting the ATMs will benefit [plaintiff] by increasing foot-traffic in the affected store locations. ‘Bank Branding’ means permitting a bank to so mark or brand an ATM such that to any person using the ATM it will appear to be owned or operated by that bank, notwithstanding the fact that the ATM continues to be owned, managed and operated by [defendant]. Additionally, the bank’s customers will be able to use any such branded ATM without paying any surcharge. In recognition of these lost surcharge transactions and to preclude any loss of fees payable to [plaintiff] hereunder, as of the date any Bank Branding arrangement becomes effective, [defendant] will determine the number of surcharged transactions conducted by said bank’s customers during the immediately preceding month at all of the ATMs covered by such arrangement (the ‘Branding Surcharge Transactions’) and thereafter through the term of this Agreement on a monthly basis will credit [plaintiff] with the full amount of the Branding Surcharge Transactions. [Plaintiff] agrees not to unreasonably withhold its consent to any Bank Branding arrangement that [defendant] may present to [plaintiff] provided that the bank covered by the proposed arrangement is one of the top five largest banks or bank holding companies in the United States. [Defendant] agrees to present, in conjunction with its chosen banking partner, a Bank Branding proposal to [plaintiff] within twelve (12) months of the execution of this Second Amendment. Failure to present a Bank Branding proposal within twelve (12) months from the date of execution of this Second Amendment will result in [defendant] paying [plaintiff] a penalty of ten thousand dollars ($10,000) per month until such Bank Branding proposal is presented to [plaintiff]” (emphasis added).
In March 2005, defendant and Chase executed a branding agreement, with plaintiff’s approval, to brand the ATMs in plaintiffs stores with the Chase name and trademark. Prior to the branding, all cardholders from any bank paid a surcharge for cash withdrawals. Following the branding, Chase cardhold*140ers would not be subject to a surcharge when withdrawing cash. Defendant commenced branding the ATMs in the summer of 2005.
In September 2005, plaintiff asserted that defendant was paying it improperly. In a letter dated October 24, 2005, plaintiff advised defendant that it interpreted the contract language at issue to mean it would be paid “one month in arrears” for all Chase transactions at branded ATMs according to the fee schedule throughout the duration of the contract. Defendant argued that it was required to make a determination of the amount of Chase transactions only once—the month before the branding agreement took effect—and pay that amount to plaintiff each month for the duration of the contract.
On October 10, 2006, plaintiff commenced this action for breach of contract and a declaratory judgment interpreting paragraph 11 (a) of the parties’ agreement. Supreme Court dismissed the breach of contract cause of action, concluding that by the plain meaning of paragraph 11 (a), “the amount of the payment... is the amount determined in that one calculation of the number of surcharged transactions in the month immediately preceding the effective date of the Arrangement. No other interpretation gives meaning to the terms, or, indeed, the paragraph as a whole” (17 Misc 3d 1101[A], 2007 NY Slip Op 51785[U], *2). Thus, the court granted plaintiffs cross motion for summary judgment as to the meaning of paragraph 11 (a) to the extent of making a declaration in defendant’s favor.
On appeal, the standard of review is for this Court to examine the contract’s language de novo (Gulf Ins. Co. v Transatlantic Reins. Co., 13 AD3d 278, 279 [2004]). Our function is to apply the meaning intended by the parties, as derived from the language of the contract in question (Lopez v Fernandito’s Antique, 305 AD2d 218, 219 [2003]). A “written agreement that is complete, clear and unambiguous on its face must be enforced according to the plain meaning of its terms” (Greenfield v Philles Records, 98 NY2d 562, 569 [2002]). In searching for the intent of the parties, our goal must be to accord the words of the contract their “fair and reasonable meaning” (Heller v Pope, 250 NY 132, 135 [1928]). In other words, “the aim is a practical interpretation of the expressions of the parties to the end that there be a ‘realization of [their] reasonable expectations’ ” (Brown Bros. Elec. Contrs. v Beam Constr. Corp., 41 NY2d 397, 400 [1977], quoting 1 Corbin, Contracts § 1). “[N]ot merely literal language, but whatever may be reasonably implied there*141from must be taken into account” (Sutton v East Riv. Sav. Bank, 55 NY2d 550, 555 [1982]).
Here, the parties contend that the language is clear and unambiguous, but each has attached a materially different meaning to paragraph 11 (a). Whether a contractual term is ambiguous must be determined by the court as a matter of law, looking solely to the plain language used by the parties within the four corners of the contract to discern its meaning and not to extrinsic sources (Kass v Kass, 91 NY2d 554, 566 [1998]).
Paragraph 11 (a) defines Bank Branding as labeling the ATMs to lead the customer to believe the ATM is owned and operated by a particular bank, when it is actually controlled by defendant. The Bank Branding arrangement also changes the surcharge structure for Chase customers, exempting them from having to pay any surcharge. The formula for determining the monthly payments under the contract is calculated “[i]n recognition of these lost surcharge transactions and to preclude any loss of fees payable to [plaintiff] hereunder.” We agree with plaintiff that application of the last antecedent doctrine is required to construe this clause properly. Relative or qualifying words or clauses in a statute ordinarily are to be applied to words or phrases immediately preceding, and are not to be construed as extending to others more remote, unless the intent clearly indicates otherwise (see McKinney’s Cons Laws of NY, Book 1, Statutes § 254). Applied to a contract, this doctrine becomes essentially an application of English language grammar, with an eye to the four corners of the contract.
In the instant case, the construction of the sentence seems to establish that the demonstrative adjective “these” modifies “lost surcharge transactions,” and the nominative phrase “these lost surcharge transactions” can only be a reference to the preceding sentence’s description of transactions where “the bank’s customers will be able to use any such branded ATM without paying any surcharge” (emphasis added) (compare Remba v Federation Empl. & Guidance Serv., 149 AD2d 131, 137 [1989], affd 76 NY2d 801 [1990]). Even though the word “lost” can be construed as describing transactions that have already taken place, “these lost surcharge transactions” equally refer to future transactions to be conducted by Chase customers, as well as transactions by the Chase customers that used the ATMs in the month prior to branding. Additionally, a portion of the same sentence promises “to preclude any loss of fees payable to [plaintiff] hereunder” (emphasis added); the word *142“hereunder” refers to the first part of this sentence, i.e. “[i]n recognition of these lost surcharge transactions,” which, as aforementioned, refers to future transactions by Chase customers who will not be charged a fee.
Paragraph 11 (a) reveals that Bank Branding will benefit plaintiff1 by increasing the foot traffic in its stores; it is reasonable to infer the parties’ expectation that allowing surcharge-free transactions to one bank’s customers will attract more of those customers to these ATMs than prior to Bank Branding, inasmuch as customers will now seek out plaintiffs stores and use these ATMs without having to go to Chase’s own ATMs. The contract, therefore, anticipates both increased foot traffic and a loss of fees payable to plaintiff as a result of the new surcharge structure, in that the surcharge fees are waived for one type of customer where none were waived before.2 It could be reasonably argued that because both results are separately accounted for, it is not the contract’s plain meaning for one to serve as the remedy for the other. In other words, increased foot traffic alone may not be meant to compensate plaintiff for the lost surcharge fees, but rather to serve as a separate incentive for plaintiff to agree to the ATM branding. If so, notwithstanding the increased foot traffic, the contract’s goal is to compensate for “loss of fees payable to [plaintiff]” due to the revenue that will no longer be collected as surcharges from Chase customers.
We note that plaintiffs position draws support from the fact that its interpretation of paragraph 11 (a) follows the spirit of the original contract, which, in section 5, calls for the good faith renegotiation of the surcharge revenue share in the event of a change in surcharge structure caused by new federal or state *143laws. Paragraph 11 (a) addresses how, “[i]n recognition of these lost surcharge transactions,” the new surcharge structure will affect the revenue share between the parties. In the third and last clause of that same sentence, “Branding Surcharge Transactions” are defined as “the number of surcharged transactions conducted by said bank’s customers during the immediately preceding month at all of the ATMs covered by such arrangement.” The motion court, however, juxtaposed the middle clause of this sentence, “as of the date any Bank Branding arrangement becomes effective,” with the words “preceding month” from the middle of the third clause. This middle clause arguably indicates that starting on the effective date of the branding agreement, defendant was required to do two things listed in the next clause: count the Branding Surcharge Transactions during one month, and then credit plaintiff with those Branding Surcharge Transactions in the following month.
The motion court noted that the provision distinguished between the “immediately preceding month” and “on a monthly basis,” and stated that if the “calculation and payment were both to have been on a monthly basis, the Arrangement would have, or should have, so stated” (2007 NY Slip Op 51785[U] at *3). We disagree that this is the only practical interpretation. The language does not detail how to calculate the monthly transactions. The amount could have been calculated on any iteration, be it every month or every day, so long as plaintiff was credited on a monthly basis for the preceding month’s actual transactions.
Furthermore, using only one month as a basis for compensation is arguably contrary to common sense. Defendant argues that the “loss of fees payable” to plaintiff includes only those from “Chase cardholders willing to use [defendant’s] ATMs in [plaintiffs] stores” even if they have to pay a surcharge, and thus, plaintiff is not “los[ing] fees that it would have been entitled to absent the bank branding arrangement.” This argument overlooks that the use of a fixed payment based on the Chase cardholders who were willing to use defendant’s ATMs in plaintiffs stores during one month arbitrarily decided by the date of the branding agreement ignores the natural and obvious fluctuations throughout the year, such as holidays when transactions are high and yield larger profits to the parties, and conversely, post-holiday periods when revenue is necessarily lower.
The motion court conceded that a contract should be construed so as to give full meaning and effect to all of its provi*144sions (Trump-Equitable Fifth Ave. Co. v H.R.H. Constr. Corp., 106 AD2d 242, 244 [1985], affd 66 NY2d 779 [1985]), but without disregarding “common sense ... in favor of formalistic literalism” (2007 NY Slip Op 51785[U] at *2; see Farrell Lines v City of New York, 30 NY2d 76 [1972]; Aron v Gillman, 309 NY 157, 163 [1955], 11 Lord, Williston on Contracts § 32:9 [4th ed]). The court correctly explained that paragraph 11 (a) is based on the fact that “that there would no longer be ‘surcharged transactions’ for Chase customers after the effective date” (2007 NY Slip Op 51785[U] at *2); conversely, before the branding agreement came into effect, there were no surcharge-free withdrawals (i.e., “lost surcharge transactions”) to be recognized, and thus there could not yet have been any corresponding “loss of fees payable to [plaintiff]” to “preclude.” Moreover, it has long been the rule, in construing contracts, that “[p] articular words should be considered, not as if isolated from the context, but in the light of the obligation as a whole and the intention of the parties as manifested thereby” (Atwater & Co. v Panama R.R. Co., 246 NY 519, 524 [1927]). This analysis indicates that the paragraph in question and this sentence’s first clause attempt to compensate plaintiff for the loss of surcharges on future transactions on Chase-branded ATMs. The intended calculation of such hypothetical compensation would necessarily also be prospective.
On the other hand, and favoring defendant’s position detailed by the motion court, is the view that once the branding agreement took effect there would be no surcharged transactions and hence plaintiff could not be entitled to payments based upon the number of nonexistent transactions. Also, the effect of adopting plaintiffs interpretation is to require defendant to pay for the increase in transactions after branding, when the purpose of the amendment could have been to compensate for loss of fees otherwise generated before there was branding. The logic of this interpretation and its result can reasonably be questioned.
Hence, in the face of the countervailing possible interpretations of the contract, we find the agreement ambiguous and remand for a trial.
Accordingly, the judgment of the Supreme Court, New York County (Bernard J. Fried, J.), entered November 15, 2007, which, to the extent appealed from as limited by the briefs, granted defendant’s motion to dismiss the cause of action for breach of contract, and granted plaintiff’s cross motion for *145partial summary judgment on the second cause of action for a declaratory judgment with respect to the meaning of paragraph 11 (a) of the second amendment to the parties’ agreement to the extent of declaring in defendant’s favor, should be reversed, on the law, with costs, defendant’s motion denied, the breach of contract cause of action reinstated, plaintiffs cross motion denied and the matter remanded for further proceedings. The appeal from the order, same court and Justice, entered on or about September 21, 2007, should be dismissed, without costs, as subsumed within the appeal from the judgment.
Friedman, J.P., Williams and Catterson, JJ, concur.Judgment, Supreme Court, New York County, entered November 15, 2007, reversed, on the law, with costs, defendant’s motion denied, the breach of contract cause of action reinstated, plaintiffs cross motion denied and the matter remanded for further proceedings. Appeal from order, same court, entered on or about September 21, 2007, dismissed, without costs, as subsumed in the appeal from the judgment.
. Although not expressly stated, Bank Branding is mutually beneficial to both parties. In section 8 of the contract, the parties provide contingency plans for locales with a low volume of transactions, thereby acknowledging that ATMs in some of plaintiffs stores may be cost-inefficient. Branding of the machines, with or without a surcharge-free population, would convert some of these placements from cost-inefficient to cost-efficient, thus benefit-ting plaintiff; likewise defendant would benefit by expanding its business into lower revenue locales. The second amendment does just this, allowing defendant to expand its business considerably.
. The agreement with Amexco precluded compensation to plaintiff from Amexco customer transactions. However, at the time of the branding agreement plaintiff and defendant had been in business without a similar surcharge-free population for upwards of a year. Moreover, Amexco is a credit card company, which provides for significantly less withdrawal transaction opportunities than with one of the five major checking banks in the United States, as made available in paragraph 11 (a). Drawing a parallel between Amexco and Chase is unconvincing, at best.