#include
#include
#include
#pragma GCC optimize("Ofast")
#define ll long long
#define ld long double
using namespace std;
signed main() {
ll n = 8;
ll a[n];
ll sum = 0;
for(ll i = 0; i < n; i++){
cin >> a[i];
if(a[i] % 6 == 0 && a[i] % 4 == 0)
sum += a[i];
}
cout << sum << "\n";</strong>
n = 12;
sum = 0;
ll b[n];
for(ll i = 0; i < n; i++){
cin >> b[i];
if(b[i] % 5 == 0)
sum++;
}
cout << sum;</strong>
}