#include<stdio.h>
int main(){
  int a,b,c,d,e,f;
  int r;
  while(1){
    scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
    if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0)break;
    a+=d;
    b+=e;
    c+=f;
    if(a<b&&a<c)     r=a;
    else if(b<a&&b<c)r=b;
    else             r=c;
    a-=r;
    b-=r;
    c-=r;
    r+=a/3;
    r+=b/3;
    r+=c/3;
    printf("%d\n",r);
  }
  return 0;
}