— Appeal from a judgment of the Court of Claims, entered October 10, 1978, which granted partial summary judgment in favor of claimant. On or about October 28, 1966, claimant entered into a $3,437,420 contract with the State to perform work in connection with the construction of the Empire State Plaza in Albany. Some four years later, claimant applied for an equitable adjustment of the contract, and following negotiations, the parties entered into a modification agreement which increased the contract price to $6,650,000. Involved on this appeal is paragraph 5 of the modification agreement which related to labor costs. It stated: "5. As part of the lump sum consideration recited at paragraph 3 [$6,650,000], the contractor shall be entitled to a sum not *733exceeding $2,650,000 for all costs incurred for labor from August 1, 1970 to completion. The costs incurred for labor shall include all those incurred by the contractor and by his subcontractors. In the event that such costs equal or exceed $2,550,000, the contractor shall nevertheless be entitled to the sum of $2,650,000 for such costs. If such costs do not equal $2,550,000, the contractor shall be entitled to 50% of the difference between such actual costs and $2,550,000.” Following completion of the work, an audit disclosed that claimant’s actual labor costs for the applicable period were $1,779,106.44. The auditors also determined that claimant had made an estimated windfall profit of $137,671.74 as a result of the Economic Stabilization Act, and, accordingly, the State unilaterally reduced the $2,550,000 figure specified in the modification agreement by $137,672 to $2,412,328. From this latter amount, the actual labor costs were subtracted to arrive at a difference of $633,221.56 which was split equally between claimant and the State. Claimant thereafter filed a claim for breach of contract and moved for partial summary judgment with respect to the credit taken by the State for labor savings and windfall profits realized by claimant. Claimant contended that under the modification agreement, it was entitled to the first $100,000 of savings reaped on the labor costs, and that any additional savings would be divided equally between it and the State. Claimant also sought the $137,671.74 which had been deducted by the State as windfall profits. The State contends that since the labor costs did not exceed $2,550,000, claimant was entitled under the plain language of the modification agreement to only 50% of the difference between the actual labor costs and $2,550,000. The Court of Claims held that claimant was entitled to the first $100,000 for labor savings and that the State was not entitled to reduce the base amounts by $137,671.74. Since this latter figure was part of the savings above the first $100,000, claimant was awarded 50% of it, or $68,835.87. Only the the State appeals. There should be an aifirmance. We reject the State’s contention that the Court of Claims improperly exercised "equitable jurisdiction” to reform the agreement (see Psaty v Duryea, 306 NY 413). To the contrary, the Court of Claims may, as it did here, interpret a contract to carry out its intention, and "words may be transposed, rejected, or supplied, to make its meaning more clear”. (Castellano v State of New York, 43 NY2d 909, 911). Here, there is an obvious ambiguity in paragraph 5 of the modification agreement. To take an example posited by the Court of Claims, according to the State’s interpretation of the modification agreement, "if the labor costs were $2,549,000, the contractor would be entitled only to $500 and would be deprived of the $100,000 to which he would be entitled if the labor costs equal $2,550,000.” We agree with the Court of Claims that this was not the intention of the parties; it leads to a totally absurd result. Therefore, the parties’ intention was a question of interpretation properly within the court’s jurisdiction (Castellano v State of New York, supra). It is a fundamental principle that the intention of the parties must be gleaned from all corners of the document (Rentways, Inc. v O’Neill Milk & Cream Co., 308 NY 342, 347), rather than from sentences or clauses viewed in isolation (Williams Press v State of New York, 37 NY2d 434, 440), and every part of the contract should be interpreted to give effect to its general purpose. Where, as here, a literal construction defeats and contravenes the purpose of the agreement, it should not be so construed (Indovision Enterprizes v Cardinal Export Corp., 44 AD2d 228, affd 36 NY2d 811). Due consideration must be given to the purposes of the parties in making the contract, and a fair and reasonable interpretation consistent with that purpose must guide the courts in enforcing the agreement (Matter *734of Cromwell Towers Redevelopment Co. v City of Yonkers, 41 NY2d 1, 6). Moreover, where, as here, a written agreement is ambiguous, resort to extrinsic evidence is permissible (Hartford Acc. & Ind. Co. v Wesolowski, 33 NY2d 169, 172), and the ambiguity should be resolved against the party who prepared the agreement (Rentways, Inc. v O’Neill Milk & Cream Co., supra, p 348), here, the State. The record discloses that the purpose of the modification agreement was to include a labor cost saving incentive provision to induce claimant to hold down labor costs and to take the risk that actual labor costs would exceed the guaranteed maximum of $2,650,000. Moreover, there is overwhelming evidence in the record consisting of letters and memoranda from State officials indicating that the parties intended that the first $100,000 in savings under $2,650,000 would go to claimant and that any additional savings would be divided equally between claimant and the State. Applying the above principles of contract law, the court properly interpreted paragraph 5 to give it its commonsense meaning in accordance with the purpose of the contract: "that the claimant was entitled to an amount between $00.00 and $100,000 under the next to last sentence of paragraph 5 of the modification agreement and to 50% of the difference between the actual costs and $2,550,000 under the last sentence of paragraph 5 of the modification agreement.” We also reject the State’s position that it should be credited with the labor savings claimant realized by virtue of the Economic Stabilization Act. The modification agreement was entered into as a calculated risk on both sides that costs would increase or decrease; the extent to which such charges would occur were risks assumed by the parties when the agreement was signed. The State cannot now complain about anticipated labor increases which did not materialize. Accordingly the judgment should be affirmed. Judgment affirmed, without costs. Mahoney, P. J., Greenblott, Sweeney, Staley, Jr., and Mikoll, JJ., concur.