import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric, std.container, std.range;

void main()
{
    auto ts = readln.split.to!(long[]);
    auto I = ts[0];
    auto O = ts[1];
    auto T = ts[2];
    auto J = ts[3];
    auto L = ts[4];
    auto S = ts[5];
    auto Z = ts[6];

    writeln(O + I/2*2 + J/2*2 + L/2*2 + (I%2 == 1 && J%2 == 1 && L%2 == 1 ? 3 : 0));
}