
    The People of the State of New York, Respondent, v James E. Gustafson, Appellant.
   Appeal from a judgment of the County Court of Tioga County (Siedlecki, J.), rendered June 10, 1983, convicting defendant upon his plea of guilty of the crime of attempted criminal possession of marihuana in the first degree. 11 After defendant’s motion to suppress was denied, he pleaded guilty to attempted criminal possession of marihuana in the first degree in full satisfaction of a three-count indictment. Sentence was imposed in accordance with a plea agreement and defendant received a term of incarceration of 120 days, to be served intermittently, and a fine of $10,000. This appeal followed. H In light of the recent United States Supreme Court decision in Oliver v United States (466 US_, 52 USLW 4425), which reaffirmed the open fields doctrine (see Hester v United States, 265 US 57), we reject defendant’s claim that the search of his property and the seizure of the marihuana plants discovered there violated the Fourth Amendment. This being so, the material seized following the execution of the subsequent search warrant cannot be suppressed as the product of previous illegal searches and seizures. 11 We are of the view, however, that the fine imposed is not legally permissible. A fine greater than $5,000 can be imposed for a felony, such as attempted criminal possession of marihuana in the first degree (see Penal Law, § 110.05, subd 5; § 221.30), only when the defendant derives a “gain” from the commission of the crime (Penal Law, § 80.00, subds 1, 2) and only after County Court makes a finding as to the amount of the “gain” (Penal Law, § 80.00, subd 3). It is conceded that County Court did not make such a finding and it is clear that any gain was nullified by the seizure of the marihuana by the police (Penal Law, § 80.00, subd 2). Accordingly, a $5,000 fine was the maximum which could have been legally imposed and County Court was powerless to impose a greater fine, notwithstanding the plea agreement (see People v Grant, 92 AD2d 985). Although this error was not raised below, this court cannot permit a sentence which is invalid as a matter of law to stand (see CPL 470.15, subd 2, par [c]; People v Grant, supra). Because the fine must be reduced, the District Attorney must be afforded an opportunity to withdraw from the plea agreement (see People v Farrar, 52 NY2d 302, 307-308; People v Ciccone, 91 AD2d 688, 689-690; see, also, Bellacosa, Practice Commentary, McKinney’s Cons Laws of NY, Book 11 A, CPL 220.10, p 206). Consequently, the matter must be remitted for further proceedings not inconsistent herewith. H Judgment reversed, on the law, and matter remitted to County Court of Tioga County for further proceedings not inconsistent herewith. Kane, J. P., Main, Casey, Levine and Harvey, JJ., concur.  