#include <iostream> using namespace std; int main() { int a; cin>>a; int k=5; int sum=0; while(k--){ int x; cin>>x; if(x<a) sum+=x; } cout<<sum<<endl; return 0; }