use strict;
use warnings;
use feature qw/say/;

# https://yukicoder.me/problems/5

my $input = "7
20
10
";

# my $input = <>;

chomp $input;

my $hash_ref;
( $hash_ref->{100}, $hash_ref->{25}, $hash_ref->{1} ) = split /\n/, $input;

my $sum = $hash_ref->{100} * 100 + $hash_ref->{25} * 25 + $hash_ref->{1};
my $coins = $sum % 1000;

my $coin_100 = int ($coins / 100);
my $coin_25  = int ( ($coins - $coin_100 * 100) / 25);
my $coin_1   = int ( ($coins - ($coin_100 * 100 ) - ($coin_25 * 25 ) ) );

say $coin_100 + $coin_25 + $coin_1 ;