#include <iostream>
#include <cstdlib>
using namespace std;
int main(){
int k[100]={0};
int A,B,C;
cin>>A>>B>>C;
int n=3;
for(int x=0;x<n;x++){
int a,b;
cin>>a>>b;
k[a-1]++;
k[b-1]–;
}
int uk=0;
for(int x=1;x<100;x++){
k[x]+=k[x-1];
}
B*=2;
C*=3;
for(int x=0;x<100;x++){
switch (k[x]){
case 1:
uk+=A;
break;
case 2:
uk+=B;
break;
case 3:
uk+=C;
}
}
cout<<uk<<endl;
system(„PAUSE“);
return EXIT_SUCCESS;
}