#!/usr/bin/perl
# your code goes here
sub plural {
my ($i, $f1, $f2, $f3) = @_;
my @data;
for (1, 21, 31, 41, 51, 61, 71, 81, 91) {
$data[$_] = \$f1;
}
for (2..4, 22..24, 32..34, 42..44,
52..54, 62..64, 72..74, 82..84, 92..94) {
$data[$_] = \$f2;
}
for (0, 5..9, 10..20, 25..30,
35..40, 45..50, 55..60, 65..70,
75..80, 85..90, 95, 96, 97, 98, 99) {
$data[$_] = \$f3;
}
}
for (1..5, 34, 35, 180, 181, 182, 255) {
printf "%d %s\n", $_, plural
($_, 'день','дня','дней'); }
IyEvdXNyL2Jpbi9wZXJsCiMgeW91ciBjb2RlIGdvZXMgaGVyZQoKc3ViIHBsdXJhbCB7CglteSAoJGksICRmMSwgJGYyLCAkZjMpID0gQF87CgkKCW15IEBkYXRhOwoJCglmb3IgKDEsIDIxLCAzMSwgNDEsIDUxLCA2MSwgNzEsIDgxLCA5MSkgewoJCSRkYXRhWyRfXSA9IFwkZjE7Cgl9CgkKCWZvciAoMi4uNCwgMjIuLjI0LCAzMi4uMzQsIDQyLi40NCwKCQkgNTIuLjU0LCA2Mi4uNjQsIDcyLi43NCwgODIuLjg0LCA5Mi4uOTQpIHsKCQkkZGF0YVskX10gPSBcJGYyOwoJfQoJCglmb3IgKDAsIDUuLjksIDEwLi4yMCwgMjUuLjMwLAogICAgCSAzNS4uNDAsIDQ1Li41MCwgNTUuLjYwLCA2NS4uNzAsCiAgICAgICAgIDc1Li44MCwgODUuLjkwLCA5NSwgOTYsIDk3LCA5OCwgOTkpIHsKICAgICAgICAkZGF0YVskX10gPSBcJGYzOwogICAgfQogICAgCiAgICByZXR1cm4gJHskZGF0YVskaSAlIDEwMF19Owp9Cgpmb3IgKDEuLjUsIDM0LCAzNSwgMTgwLCAxODEsIDE4MiwgMjU1KSB7CglwcmludGYgIiVkICVzXG4iLCAkXywgcGx1cmFsKCRfLCAn0LTQtdC90YwnLCfQtNC90Y8nLCfQtNC90LXQuScpOwp9