#include <iostream>
#include <bitset>
using namespace std;
bitset<1000001>vc;
int main()
{
int n, m, i, j, s=0, num;
cin >> n >> m;
for (i=1; i<=n; ++i)
for (j=1; j<=m; ++j)
{
cin >> num; vc[num]=1;
}
for (i=0; i<=1000001; ++i)
if (vc[i] && i%2==0) { s+=i; }
cout << s;
return 0;
}