#include int main() { int t, n, m; scanf("%d", &t); while (t--) { scanf("%d %d", &n, &m); printf("%d\n", n / 2 + m / 2); } return 0; }