Use Genitive Singular nouns with numerals ending in двђ, двљ, трќ, четІре.
Note that the word for 'two' distinguishes gender: use двљ with feminine nouns and двђ with masculine or neuter.
двљ кнќги двђ стакђна двђ слћва 2
двђдцать двљ кнќги двђдцать двђ стакђна двђдцать двђ слћва 22
трќ кнќги трќ стакђна трќ слћва 3
двђдцать трќ кнќги двђдцать трќ стакђна двђдцать трќ слћва 23
четІре кнќги четІре стакђна четІре слћва 4
двђдцать четІре кнќги двђдцать четІре стакђна двђдцать четІре слћва 24
пїть кнќг пїть стакђнов пїть слћв 5
двђдцать пїть кнќг двђдцать пїть стакђнов двђдцать пїть слћв 25
двђдцать кнќг двђдцать стакђнов двђдцать слћв 20
шестнђдцать кнќг шестнђдцать стакђнов шестнђдцать слћв 16
Note that this rules specifically mentions the forms двђ, двљ, трќ, четІре, пїть, etc., i.e. the Nominative form (or Accusative, when it is identical to Nominative). The rule does not apply to phrases where the numeral is in any other case form. In these phrases the case of the noun is determined by other elements of the sentence, and the number is determined by how many things you're talking about:
Ї говорќл о двџх (Prep.) дљвушках (Prep. Plur.). I spoke about two girls.
Ї вќдел двџх (Acc.) дљвушeк (Acc. Plur.). I saw two girls.
омлљт из трёх (Gen.) яќц (Gen. Plur.) a three-egg omelette (Lit., an omelette [made] from three eggs)