#include<stdio.h>
#include<algorithm>
using namespace std;
struct cyin{
    int lc,rc;
    long long c;
};
struct treeaa{
    int tl,tr;
    cyin cc;
}t[1000000];
long long x[150010];
long long ans,d[150010],sum[150010];
int n,m,c;
void cal(int i){
    int sl,sr;
    sl=i*2;sr=i*2+1;
    t[i].cc.c=0;
    if (t[sl].cc.c>0&&t[i].cc.c<t[sl].cc.c){
        t[i].cc=t[sl].cc;
    }
    if (t[sr].cc.c>0&&t[i].cc.c<t[sr].cc.c){
        t[i].cc=t[sr].cc;
    }
    if (t[sl].cc.c>0&&t[sr].cc.c>0&&t[i].cc.c<sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1]){
        t[i].cc.c=sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1];
        t[i].cc.lc=t[sl].cc.lc;
        t[i].cc.rc=t[sr].cc.rc;
    }
}
void build_tree(int i,int l,int r){
    int mid=(l+r)/2;
    t[i].tl=l;
    t[i].tr=r;
    if (l==r){
        if (d[l]<=0) t[i].cc.c=0;
        else{
            t[i].cc.c=d[l];
            t[i].cc.lc=l;
            t[i].cc.rc=r;
        }
        return;
    }else {
        build_tree(i*2,l,mid);
        build_tree(i*2+1,mid+1,r);
    }
    cal(i);
}
cyin check(int i,int l,int r){
    if (t[i].tl==l&&t[i].tr==r) return t[i].cc;
    int mid=(t[i].tl+t[i].tr)/2;
    if (r<=mid) return check(i*2,l,r);
    else if (l>mid) return check(i*2+1,l,r);
    else {
        cyin tt;
        cyin t1=check(i*2,l,mid);
        cyin t2=check(i*2+1,mid+1,r);
        tt.c=0;
        if (t1.c>0&&tt.c<t1.c) tt=t1;
        if (t2.c>0&&tt.c<t2.c) tt=t2;
        if (t1.c>0&&t2.c>0&&tt.c<sum[t2.rc]-sum[t1.lc-1]){
            tt.c=sum[t2.rc]-sum[t1.lc-1];
            tt.lc=t1.lc;
            tt.rc=t2.rc;
        }
        return tt;
    }
}

int main(){
    int i,l,r;
    int p;
    scanf("%d%d%d",&n,&m,&c);
    for (i=0;i<n;i++) scanf("%I64d",&x[i]);
    sum[0]=0;
    for (i=0;i<n-1;i++){
        scanf("%d",&p);
        d[i+1]=(x[i+1]-x[i])*50-p*c;
        sum[i+1]=sum[i]+d[i+1];
    }
    build_tree(1,1,n-1);
    ans=0;
    for (i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        r--;
        ans+=check(1,l,r).c;
    }
    printf("%lf\n",ans/100.0);
    return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
struct cyin{
    int lc,rc;
    long long c;
};
struct treeaa{
    int tl,tr;
    cyin cc;
}t[1000000];
int x[150010];
long long ans,d[150010],sum[150010];
int n,m,c;
void cal(int i){
    int sl,sr;
    sl=i*2;sr=i*2+1;
    t[i].cc.c=t[i].cc.lc=t[i].cc.rc=0;
    if (t[sl].cc.c>0&&t[i].cc.c<t[sl].cc.c){
        t[i].cc=t[sl].cc;
    }
    if (t[sr].cc.c>0&&t[i].cc.c<t[sr].cc.c){
        t[i].cc=t[sr].cc;
    }
    if (t[sl].cc.c>0&&t[sr].cc.c>0&&t[i].cc.c<sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1]){
        t[i].cc.c=sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1];
        t[i].cc.lc=t[sl].cc.lc;
        t[i].cc.rc=t[sr].cc.rc;
    }
}
void build_tree(int i,int l,int r){
    int mid=(l+r)/2;
    t[i].tl=l;
    t[i].tr=r;
    if (l==r){
        if (d[l]<=0) t[i].cc.c=t[i].cc.lc=t[i].cc.rc=0;
        else{
            t[i].cc.c=d[l];
            t[i].cc.lc=l;
            t[i].cc.rc=r;
        }
        return;
    }else {
        build_tree(i*2,l,mid);
        build_tree(i*2+1,mid+1,r);
    }
    cal(i);
}
cyin check(int i,int l,int r){
    if (t[i].tl==l&&t[i].tr==r) return t[i].cc;
    int mid=(t[i].tl+t[i].tr)/2;
    if (r<=mid) return check(i*2,l,r);
    else if (l>mid) return check(i*2+1,l,r);
    else {
        cyin tt;
        cyin t1=check(i*2,l,mid);
        cyin t2=check(i*2+1,mid+1,r);
        tt.c=tt.lc=tt.rc=0;
        if (t1.c>0&&tt.c<t1.c) tt=t1;
        if (t2.c>0&&tt.c<t2.c) tt=t2;
        if (t1.c>0&&t2.c>0&&tt.c<sum[t2.rc]-sum[t1.lc-1]){
            tt.c=sum[t2.rc]-sum[t1.lc-1];
            tt.lc=t1.lc;
            tt.rc=t2.rc;
        }
        return tt;
    }
}

int main(){
    int i,l,r;
    int p;
    scanf("%d%d%d",&n,&m,&c);
    for (i=0;i<n;i++) scanf("%d",&x[i]);
    sum[0]=0;
    for (i=0;i<n-1;i++){
        scanf("%d",&p);
        d[i+1]=(long long)(x[i+1]-x[i])*50-p*c;
        sum[i+1]=sum[i]+d[i+1];
    }
    build_tree(1,1,n-1);
    ans=0;
    for (i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        r--;
        ans+=check(1,l,r).c;
    }
    printf("%lf\n",ans/100.0);
    return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
struct cyin{
    long long mxl,mxr,mx;
    long long sum;
};
struct treeaa{
    int tl,tr;
    cyin cc;
}t[1000000];
int x[150010];
long long ans,d[150010];
int n,m,c;
void cal(int i){
    int sl,sr;
    sl=i*2;sr=i*2+1;
    t[i].cc.sum=t[sl].cc.sum+t[sr].cc.sum;
    t[i].cc.mx=max(t[sl].cc.mxr+t[sr].cc.mxl,max(t[sl].cc.mx,t[sr].cc.mx));
    t[i].cc.mxl=max(t[sl].cc.mxl,t[sl].cc.sum+t[sr].cc.mxl);
    t[i].cc.mxr=max(t[sr].cc.mxr,t[sr].cc.sum+t[sl].cc.mxr);
}
void build_tree(int i,int l,int r){
    int mid=(l+r)/2;
    t[i].tl=l;
    t[i].tr=r;
    if (l==r){
        t[i].cc.sum=d[l];
        if (d[l]<=0) t[i].cc.mx=t[i].cc.mxl=t[i].cc.mxr=0;
        else t[i].cc.mx=t[i].cc.mxl=t[i].cc.mxr=d[l];
        return;
    }else {
        build_tree(i*2,l,mid);
        build_tree(i*2+1,mid+1,r);
    }
    cal(i);
}
cyin check(int i,int l,int r){
    if (t[i].tl==l&&t[i].tr==r) return t[i].cc;
    int mid=(t[i].tl+t[i].tr)/2;
    if (r<=mid) return check(i*2,l,r);
    else if (l>mid) return check(i*2+1,l,r);
    else {
        cyin tt;
        cyin t1=check(i*2,l,mid);
        cyin t2=check(i*2+1,mid+1,r);
        tt.sum=t1.sum+t2.sum;
        tt.mx=max(t1.mxr+t2.mxl,max(t1.mx,t2.mx));
        tt.mxl=max(t1.mxl,t1.sum+t2.mxl);
        tt.mxr=max(t2.mxr,t2.sum+t1.mxr);
        return tt;
    }
}

int main(){
    //freopen("c.in","r",stdin);
    int i,l,r;
    int p;
    scanf("%d%d%d",&n,&m,&c);
    for (i=0;i<n;i++) scanf("%d",&x[i]);
    for (i=0;i<n-1;i++){
        scanf("%d",&p);
        d[i+1]=(long long)(x[i+1]-x[i])*50-p*c;
    }
    build_tree(1,1,n-1);
    ans=0;
    for (i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        r--;
        ans+=check(1,l,r).mx;
    }
    printf("%lf\n",ans/100.0);
    return 0;
}


#include<stdio.h>
#include<algorithm>
using namespace std;
struct cyin{
    int lc,rc;
    double c;
};
struct treeaa{
    int tl,tr;
    cyin cc;
}t[1000000];
int x[150010];
double ans,d[150010],sum[150010];
int n,m,c;
void cal(int i){
    int sl,sr;
    sl=i*2;sr=i*2+1;
    t[i].cc.c=0;
    if (t[sl].cc.c>0&&t[i].cc.c<t[sl].cc.c){
        t[i].cc=t[sl].cc;
    }
    if (t[sr].cc.c>0&&t[i].cc.c<t[sr].cc.c){
        t[i].cc=t[sr].cc;
    }
    if (t[sl].cc.c>0&&t[sr].cc.c>0&&t[i].cc.c<sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1]){
        t[i].cc.c=sum[t[sr].cc.rc]-sum[t[sl].cc.lc-1];
        t[i].cc.lc=t[sl].cc.lc;
        t[i].cc.rc=t[sr].cc.rc;
    }
}
void build_tree(int i,int l,int r){
    int mid=(l+r)/2;
    t[i].tl=l;
    t[i].tr=r;
    if (l==r){
        if (d[l]<0) t[i].cc.c=0;
        else{
            t[i].cc.c=d[l];
            t[i].cc.lc=l;
            t[i].cc.rc=r;
        }
        return;
    }else {
        build_tree(i*2,l,mid);
        build_tree(i*2+1,mid+1,r);
    }
    cal(i);
}
cyin check(int i,int l,int r){
  //  printf("%d %d %d\n",i,l,r);
    if (t[i].tl==l&&t[i].tr==r){
       // printf("%d %d %d\n",i,l,r);
        return t[i].cc;
    }
    int mid=(t[i].tl+t[i].tr)/2;
    if (r<=mid) return check(i*2,l,r);
    else if (l>mid) return check(i*2+1,l,r);
    else {
        cyin tt;
        cyin t1=check(i*2,l,mid);
        cyin t2=check(i*2+1,mid+1,r);
        tt.c=0;
        if (t1.c>0&&tt.c<t1.c) tt=t1;
        if (t2.c>0&&tt.c<t2.c) tt=t2;
        if (t1.c>0&&t2.c>0&&tt.c<sum[t2.rc]-sum[t1.lc-1]){
            tt.c=sum[t2.rc]-sum[t1.lc-1];
            tt.lc=t1.lc;
            tt.rc=t2.rc;
        }
        return tt;
    }
}

int main(){
   // freopen("c.in","r",stdin);
    int i,j,l,r;
    int p;
    scanf("%d%d%d",&n,&m,&c);
    for (i=0;i<n;i++) scanf("%d",&x[i]);
    sum[0]=0;
    for (i=0;i<n-1;i++){
        scanf("%d",&p);
        d[i+1]=(x[i+1]-x[i])/2.0-p/100.0*c;
       // printf("%.2lf ",d[i+1]);
        sum[i+1]=sum[i]+d[i+1];
    }
   // printf("\n");
    build_tree(1,1,n-1);
    ans=0;
    for (i=0;i<m;i++){
        scanf("%d%d",&l,&r);
        r--;
        ans+=check(1,l,r).c;
      //  printf("%.2lf %d %d\n",check(1,l,r).c,check(1,l,r).lc,check(1,l,r).rc);
       // printf("%lf\n",sum[r]-sum[l-1]-check(1,l,r).c);
    }
    printf("%lf\n",ans);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Pii pair<int,int>
#define Pll pair<lng,lng>
#define Pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int mymax(int a,int b){return a<b?b:a;}
inline int mymin(int a,int b){return a>b?b:a;}
inline ll mymax(ll a,ll b){return a<b?b:a;}
inline ll mymin(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int MAXN = 2*1e5+10;
const ll MD = 1e18;

double x[MAXN],p[MAXN];

struct segtree{
  double sum,lsum,rsum,best;
} seg[6*MAXN];

void maketree(int nod, int a,int b, int c){
  if(a==b){
    seg[nod].sum=(x[a+1]-x[a])*(1-p[a])/2 + ((x[a+1]-x[a])/2 - c)*p[a];
    seg[nod].lsum=seg[nod].rsum=seg[nod].sum;
    seg[nod].best=seg[nod].sum;
    if(seg[nod].best<0) seg[nod].best=0;
    return ;
  }
  maketree(2*nod, a, (a+b)/2,c);
  maketree(2*nod+1, (a+b)/2+1,b,c);
  seg[nod].sum=seg[2*nod].sum+seg[2*nod+1].sum;
  seg[nod].lsum=seg[2*nod].lsum;
  if(seg[nod].lsum<seg[2*nod].sum+seg[2*nod+1].lsum) seg[nod].lsum=seg[2*nod].sum+seg[2*nod+1].lsum;
  seg[nod].rsum=seg[2*nod+1].rsum;
  if(seg[nod].rsum<seg[2*nod].rsum+seg[2*nod+1].sum) seg[nod].rsum=seg[2*nod].rsum+seg[2*nod+1].sum;
  seg[nod].best=seg[2*nod].best;
  if(seg[nod].best<seg[2*nod+1].best) seg[nod].best=seg[2*nod+1].best;
  if(seg[nod].best<seg[2*nod].rsum+seg[2*nod+1].lsum) seg[nod].best=seg[2*nod].rsum+seg[2*nod+1].lsum;
}

struct segtree query(int nod, int a,int b , int l, int r){
  struct segtree A,L,R;
  if(a>r || b<l){
    A.sum=A.best=A.lsum=A.rsum=0;
    return A;
  }
  if(a>=l && b<=r)  return seg[nod];

  L = query(2*nod,a,(a+b)/2,l,r);
  R = query(2*nod+1,(a+b)/2+1,b,l,r);
  A.sum=L.sum+R.sum;
  A.lsum=L.lsum;
  if(A.lsum<L.sum+R.lsum) A.lsum=L.sum+R.lsum;
  A.rsum=R.rsum;
  if(A.rsum<L.rsum+R.sum) A.rsum=L.rsum+R.sum;
  A.best=L.best;
  if(A.best<R.best) A.best=R.best;
  if(A.best<L.rsum+R.lsum) A.best=L.rsum+R.lsum;
  return A;
}

int main(){
  int n,m,c;
  scanf("%d %d %d",&n,&m,&c);
  REP(i,n){
    scanf("%lf",&x[i+1]);
  }
//  printf("hi\n");
  REP(i,n-1){  scanf("%lf",&p[i+1]);p[i+1]/=100;}
//  printf("hi\n");
  maketree(1,1,n-1,c);
//  printf("hi\n");
  double ans=0;
  REP(i,m){
    int x1,x2;
    scanf("%d %d",&x1,&x2);
    ans+=query(1,1,n-1,x1,x2-1).best;
  }
  printf("%lf\n",ans);
  return 0;
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define Pii pair<int,int>
#define Pll pair<lng,lng>
#define Pdd pair<double,double>
#define X first
#define Y second
#define REP(i,a) for(int i=0;i<a;++i)
#define REPP(i,a,b) for(int i=a;i<b;++i)
#define FILL(a,x) memset(a,x,sizeof(a))
#define	foreach( gg,itit )	for( typeof(gg.begin()) itit=gg.begin();itit!=gg.end();itit++ )
#define	mp make_pair
#define	pb push_back
#define sz(a) int((a).size())
#define	debug(ccc)	cout << #ccc << " = " << ccc << endl;
#define present(c,x) ((c).find(x) != (c).end())
#define EQ(a,b) (fabs((a)-(b))<eps)
inline int mymax(int a,int b){return a<b?b:a;}
inline int mymin(int a,int b){return a>b?b:a;}
inline ll mymax(ll a,ll b){return a<b?b:a;}
inline ll mymin(ll a,ll b){return a>b?b:a;}
const int mod = 1e9+7;
const int MAXN = 2*1e5+10;
const ll MD = 1e18;

double x[MAXN],p[MAXN];

struct segtree{
  double sum,lsum,rsum,best;
} seg[6*MAXN];

void maketree(int nod, int a,int b, int c){
  if(a==b){
    seg[nod].sum=(x[a+1]-x[a])*(1-p[a])/2 + ((x[a+1]-x[a])/2 - c)*p[a];
    seg[nod].lsum=seg[nod].rsum=seg[nod].sum;
    seg[nod].best=seg[nod].sum;
    if(seg[nod].best<0) seg[nod].best=0;
    return ;
  }
  maketree(2*nod, a, (a+b)/2,c);
  maketree(2*nod+1, (a+b)/2+1,b,c);
  seg[nod].sum=seg[2*nod].sum+seg[2*nod+1].sum;
  seg[nod].lsum=seg[2*nod].lsum;
  if(seg[nod].lsum<seg[2*nod].sum+seg[2*nod+1].lsum) seg[nod].lsum=seg[2*nod].sum+seg[2*nod+1].lsum;
  seg[nod].rsum=seg[2*nod+1].rsum;
  if(seg[nod].rsum<seg[2*nod].rsum+seg[2*nod+1].sum) seg[nod].rsum=seg[2*nod].rsum+seg[2*nod+1].sum;
  seg[nod].best=seg[2*nod].best;
  if(seg[nod].best<seg[2*nod+1].best) seg[nod].best=seg[2*nod+1].best;
  if(seg[nod].best<seg[2*nod].rsum+seg[2*nod+1].lsum) seg[nod].best=seg[2*nod].rsum+seg[2*nod+1].lsum;
}

struct segtree query(int nod, int a,int b , int l, int r){
  struct segtree A,L,R;
  if(a>r || b<l){
    A.sum=A.best=A.lsum=A.rsum=0;
    return A;
  }
  if(a==b){
    return seg[nod];
  }
  L = query(2*nod,a,(a+b)/2,l,r);
  R = query(2*nod+1,(a+b)/2+1,b,l,r);
  A.sum=L.sum+R.sum;
  A.lsum=L.lsum;
  if(A.lsum<L.sum+R.lsum) A.lsum=L.sum+R.lsum;
  A.rsum=R.rsum;
  if(A.rsum<L.rsum+R.sum) A.rsum=L.rsum+R.sum;
  A.best=L.best;
  if(A.best<R.best) A.best=R.best;
  if(A.best<L.rsum+R.lsum) A.best=L.rsum+R.lsum;
  return A;
}

int main(){
  int n,m,c;
  scanf("%d %d %d",&n,&m,&c);
  REP(i,n){
    scanf("%lf",&x[i+1]);
  }
//  printf("hi\n");
  REP(i,n-1){  scanf("%lf",&p[i+1]);p[i+1]/=100;}
//  printf("hi\n");
  maketree(1,1,n-1,c);
//  printf("hi\n");
  double ans=0;
  REP(i,m){
    int x1,x2;
    scanf("%d %d",&x1,&x2);
    ans+=query(1,1,n-1,x1,x2-1).best;
  }
  printf("%lf\n",ans);
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;

class slow_not_tree {
  vll vals;

  public:
  slow_not_tree(const vll &_vals) : vals(_vals) {}
  ll get(int l0, int r0) {
    ll res = 0;
    for (int l = l0; l <= r0; l++) {
      ll csum = 0;
      for (int r = l; r <= r0; r++) {
        csum += vals[r];
        res = max(res, csum);
      }
    }
    return res;
  }
};

int main() {
  #ifdef DEBUG
  freopen("std.in", "r", stdin);
  freopen("std.out", "w", stdout);
  #endif

  int n, m, c;
  while (scanf("%d%d%d", &n, &m, &c) >= 1) {
    vi xs(n), ps(n - 1);
    for (int i = 0; i < n; i++)
      scanf("%d", &xs[i]);
    for (int i = 0; i + 1 < n; i++)
      scanf("%d", &ps[i]);

    vector<ll> vals(n - 1);
    for (int i = 0; i + 1 < n; i++) {
      vals[i] = ll(xs[i + 1] - xs[i]) * 50 - ll(c) * ps[i];
      eprintf("%I64d\n", vals[i]);
    }

    slow_not_tree tr(vals);
    ll ans = 0;
    for (int i = 0; i < m; i++) {
      int l, r;
      scanf("%d%d", &l, &r), l--, r -= 2;
      ans += tr.get(l, r);
    }
    printf("%.18lf\n", ans / 100.0);
    break;
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;

class segm_tree {
  vll tr, trsum, trsuf, trpref;
  int off;

  int lr, rr;
  void _get(int v, int lt, int rt, ll &res, ll &rsum, ll &rsuf, ll &rpref) {
    res = rsum = rsuf = rpref = 0;
    if (rt < lr || rr < lt) return;
//    eprintf("v=%d\n", v);
//    eprintf("%I64d %I64d %I64d %I64d\n", tr[v], trsum[v], trsuf[v], trpref[v]);
    if (lr <= lt && rt <= rr) {
      res = tr[v];
      rsum = trsum[v];
      rsuf = trsuf[v];
      rpref = trpref[v];
      return;
    }

    int mt = (lt + rt) / 2;
    ll _lres, _lsum, _lsuf, _lpref;
    ll _rres, _rsum, _rsuf, _rpref;
    _get(2 * v    , lt    , mt, _lres, _lsum, _lsuf, _lpref);
    _get(2 * v + 1, mt + 1, rt, _rres, _rsum, _rsuf, _rpref);

    rsum = _lsum + _rsum;
    rsuf = max(_lsuf + _rsum, _rsuf);
    rpref = max(_lsum + _rpref, _lpref);
    res = max(max(_lres, _rres), _lsuf + _rpref);
  }

  public:
  segm_tree(const vll &vals) {
    off = 1; while (off < sz(vals)) off <<= 1;

    tr = vll(2 * off, 0);
    trsum = vll(2 * off, 0);
    trsuf = vll(2 * off, 0);
    trpref = vll(2 * off, 0);
    for (int i = 0; i < sz(vals); i++) {
      trsum[off + i] = vals[i];
      trsuf[off + i] =
      trpref[off + i] =
      tr[off + i] = max(tr[i], vals[i]);
    }

    for (int i = off - 1; i >= 0; i--) {
      trsum[i] = trsum[2 * i] + trsum[2 * i + 1];
      trsuf[i] = max(trsuf[2 * i] + trsum[2 * i + 1], trsuf[2 * i + 1]);
      trpref[i] = max(trsum[2 * i] + trpref[2 * i + 1], trpref[2 * i]);
      tr[i] = max(max(tr[2 * i], tr[2 * i + 1]), trsuf[2 * i] + trpref[2 * i + 1]);
    }
  }

  ll get(int _l, int _r) {
    lr = _l; rr = _r;
    ll res, rsum, rsuf, rpref;
    _get(1, 0, off - 1, res, rsum, rsuf, rpref);
    return res;
  }
};

int main() {
  #ifdef DEBUG
  freopen("std.in", "r", stdin);
  freopen("std.out", "w", stdout);
  #endif

  int n, m, c;
  while (scanf("%d%d%d", &n, &m, &c) >= 1) {
    vi xs(n), ps(n - 1);
    for (int i = 0; i < n; i++)
      scanf("%d", &xs[i]);
    for (int i = 0; i + 1 < n; i++)
      scanf("%d", &ps[i]);

    vector<ll> vals(n - 1);
    for (int i = 0; i + 1 < n; i++) {
      vals[i] = ll(xs[i + 1] - xs[i]) * 50 - ll(c) * ps[i];
//      eprintf("%I64d\n", vals[i]);
    }

    segm_tree tr(vals);
    ll ans = 0;
    for (int i = 0; i < m; i++) {
      int l, r;
      scanf("%d%d", &l, &r), l--, r -= 2;
      ans += tr.get(l, r);
    }
    printf("%.18lf\n", ans / 100.0);
    break;
  }
  return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <string>
#include <vector>

using namespace std;

#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define pb push_back
#define mp make_pair
#define sz(x) ((int)(x).size())

typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> pii;

class segm_tree {
  vll tr, trsum, trsuf, trpref;
  int off;

  int lr, rr;
  void _get(int v, int lt, int rt, ll &res, ll &rsum, ll &rsuf, ll &rpref) {
    res = rsum = rsuf = rpref = 0;
    if (rt < lr || rr < lt) return;
//    eprintf("v=%d\n", v);
//    eprintf("%I64d %I64d %I64d %I64d\n", tr[v], trsum[v], trsuf[v], trpref[v]);
    if (lr <= lt && rt <= rr) {
      res = tr[v];
      rsum = trsum[v];
      rsuf = trsuf[v];
      rpref = trpref[v];
      return;
    }

    int mt = (lt + rt) / 2;
    ll _lres, _lsum, _lsuf, _lpref;
    ll _rres, _rsum, _rsuf, _rpref;
    _get(2 * v    , lt    , mt, _lres, _lsum, _lsuf, _lpref);
    _get(2 * v + 1, mt + 1, rt, _rres, _rsum, _rsuf, _rpref);

    rsum = _lsum + _rsum;
    rsuf = max(_lsuf + _rsum, _rsuf);
    rpref = max(_lsum + _rpref, _lpref);
    res = max(max(_lres, _rres), max(_lsuf + _rsum, _lsum + _rpref));
  }

  public:
  segm_tree(const vll &vals) {
    off = 1; while (off < sz(vals)) off <<= 1;

    trsum = vll(2 * off, 0);
    tr = vll(2 * off, 0);
    trsuf = vll(2 * off, 0);
    trpref = vll(2 * off, 0);
    for (int i = 0; i < sz(vals); i++) {
      trsum[off + i] = vals[i];
      trsuf[off + i] =
      trpref[off + i] =
      tr[off + i] = max(tr[i], vals[i]);
    }

    for (int i = off - 1; i >= 0; i--) {
      trsum[i] = trsum[2 * i] + trsum[2 * i + 1];
      trsuf[i] = max(trsuf[2 * i] + trsum[2 * i + 1], trsuf[2 * i + 1]);
      trpref[i] = max(trsum[2 * i] + trpref[2 * i + 1], trpref[2 * i]);
      tr[i] = max(max(tr[2 * i], tr[2 * i + 1]), trsuf[2 * i] + trpref[2 * i + 1]);
    }
  }

  ll get(int _l, int _r) {
    lr = _l; rr = _r;
    ll res, rsuf, rpref, rsum;
    _get(1, 0, off - 1, res, rsum, rsuf, rpref);
    return res;
  }
};

int main() {
  #ifdef DEBUG
  freopen("std.in", "r", stdin);
  freopen("std.out", "w", stdout);
  #endif

  int n, m, c;
  while (scanf("%d%d%d", &n, &m, &c) >= 1) {
    vi xs(n), ps(n - 1);
    for (int i = 0; i < n; i++)
      scanf("%d", &xs[i]);
    for (int i = 0; i + 1 < n; i++)
      scanf("%d", &ps[i]);

    vector<ll> vals(n - 1);
    for (int i = 0; i + 1 < n; i++) {
      vals[i] = ll(xs[i + 1] - xs[i]) * 50 - ll(c) * ps[i];
//      eprintf("%I64d\n", vals[i]);
    }

    segm_tree tr(vals);
    ll ans = 0;
    for (int i = 0; i < m; i++) {
      int l, r;
      scanf("%d%d", &l, &r), l--, r -= 2;
      ans += tr.get(l, r);
    }
    printf("%.18lf\n", ans / 100.0);
    break;
  }
  return 0;
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;

#define n   150005
#define DB  double
#define For(i,a,b)  for(int i=a;i<=b;i++)

int     N,M,C,A[n];
DB      Ans,X[n],P[n];

struct  Nod{
        DB  L,R,S,Max;

        void    reset(){
            L=max(0.,L);    R=max(0.,R);    Max=max(0.,Max);
        }
        Nod operator +  (const Nod&b){
            Nod c,a=*this;
            c.S=a.S+b.S;
            c.L=max(a.L,a.S+b.L);
            c.R=max(b.R,b.S+a.R);
            c.Max=max(max(a.Max,b.Max),a.R+b.L);
            reset();    return  c;
        }
}T[n<<2];

void    Build(int u,int l,int r){
        if  (l==r)  {
            T[u]=(Nod){X[l],X[l],X[l],X[l]};    T[u].reset();
            return  ;
        }   int Mid=l+r>>1;
        Build(u<<1,l,Mid);  Build(u<<1|1,Mid+1,r);  T[u]=T[u<<1]+T[u<<1|1];
}
Nod     Query(int u,int l,int r,int x,int y){
        if  (x<=l&&r<=y)return  T[u];   int Mid=l+r>>1;
        if  (y<=Mid)    return  Query(u<<1,l,Mid,x,y);
        if  (x>Mid)     return  Query(u<<1|1,Mid+1,r,x,y);
        return  Query(u<<1,l,Mid,x,y)+Query(u<<1|1,Mid+1,r,x,y);
}

int     main(){
        scanf("%d%d%d",&N,&M,&C);
        For(i,1,N)  scanf("%d",&A[i]);  N--;
        For(i,1,N)  scanf("%lf",&P[i]),X[i]=(A[i+1]-A[i])*.5-P[i]/100.*C;

        Build(1,1,N);
        for (int l,r;M--;)
            scanf("%d%d",&l,&r),Ans+=Query(1,1,N,l,r-1).Max;
        printf("%.10lf\n",Ans);
}


#include<set>
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int maxn=150000+10;
int n,m,c,a[maxn];
double b[maxn];
struct node{
	double lmx,rmx,mmx,sum;
	friend node operator +(node A,node B)
	{
		node C;
		C.sum=A.sum+B.sum;
		C.lmx=max(A.lmx,A.sum+B.lmx);
		C.rmx=max(B.rmx,B.sum+A.rmx);
		C.mmx=max(max(A.mmx,B.mmx),A.rmx+B.lmx);
		return C;
	}
}tr[maxn*8],ans;

void build(int x,int l,int r)
{
	if(l==r)
	{
		tr[x].sum=b[l];
		tr[x].lmx=tr[x].rmx=tr[x].mmx=max(0.0,b[l]);
		return;
	}
	int mid=(l+r)/2;
	build(x*2,l,mid);
	build(x*2+1,mid+1,r);
	tr[x]=tr[x*2]+tr[x*2+1];
}

void qry(int x,int l,int r,int L,int R)
{
	if(L<=l && R>=r)
	{
		ans=ans+tr[x];
		return;
	}
	int mid=(l+r)/2;
	if(L<=mid)qry(x*2,l,mid,L,R);
	if(R>mid)qry(x*2+1,mid+1,r,L,R);
}

int main()
{
	scanf("%d%d%d",&n,&m,&c);
	for(int i = 1;i <= n;i++)
		scanf("%d",&a[i]);
	n--;
	for(int i = 1;i <= n;i++)
	{
		int x;
		scanf("%d",&x);
		b[i]=a[i+1]-a[i];
		b[i]-=2.0*x*c/100.0;
		//printf("%.6lf ",b[i]);
	}
	build(1,1,n);
	double sum=0;
	for(int i = 1;i <= m;i++)
	{
		ans=(node){0,0,0,0};
		int l,r;
		scanf("%d%d",&l,&r);
		qry(1,1,n,l,r-1);
		sum+=ans.mmx;
		//printf("%.8lf\n",ans.mmx);
	}
	printf("%.8lf\n",sum/2);
	return 0;
}


/*AMETHYSTS*/
//#pragma comment(linker, "/STACK:1000000000")
#include <cstdio>
#include <iostream>
#include <ctime>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <set>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <bitset>
#include <fstream>
#include <deque>
#include <stack>
#include <climits>
#include <string>
#include <queue>
#include <memory.h>
#include <map>
#include <unordered_map>

#define ll long long
#define ld double
#define pii pair <int, int>
#define pll pair <ll, ll>
#define mp make_pair

using namespace std;

const int maxn = (int)3e5 + 10;
int t[4 * maxn];

void sets(int it, int x) {
	t[it] += x;
}

void push(int it) {
	if (t[it] != 0) {
		sets(2 * it, t[it]);
		sets(2 * it + 1, t[it]);
		t[it] = 0;
	}
}

void change(int it, int l, int r, int lm, int rm, int x) {
	if (l == lm && r == rm) {
		sets(it, x);
	} else {
		push(it);
		int m = (l + r) >> 1;

		if (rm <= m) {
			change(2 * it, l, m, lm, rm, x);
		} else if (lm > m) {
			change(2 * it + 1, m + 1, r, lm, rm, x);
		} else {
			change(2 * it, l, m, lm, m, x);
			change(2 * it + 1, m + 1, r, m + 1, rm, x);
		}
	}
}

int v[maxn];

void make(int it, int l, int r) {
	if (l == r) {
		v[l] = t[it];
	} else {
		push(it);
		int m = (l + r) >> 1;

		make(2 * it, l, m);
		make(2 * it + 1, m + 1, r);
	}
}

pair <pll, pll> tr[4 * maxn];

pair <pll, pll> merg(pair <pll, pll> a, pair <pll, pll> b) {
	pair <pll, pll> c;

	c.second.second = max(max(a.second.second, b.second.second), a.first.second + b.first.first);
	c.second.first = a.second.first + b.second.first;
	c.first.first = max(a.first.first, a.second.first + b.first.first);
	c.first.second = max(b.first.second, b.second.first + a.first.second);

	return c;
}

ll z[maxn];

void build(int it, int l, int r) {
	if (l == r) {
		tr[it] = mp(mp(z[l], z[l]), mp(z[l], z[l]));
		if (z[l] < 0) {
			tr[it] = mp(mp(0, 0), mp(z[l], 0));
		}
	} else {
		int m = (l + r) >> 1;

		build(2 * it, l, m);
		build(2 * it + 1, m + 1, r);

		tr[it] = merg(tr[2 * it], tr[2 * it + 1]);
	}
}

pair <pll, pll> go(int it, int l, int r, int lm, int rm) {
	if (l == lm && r == rm) {
		return tr[it];
	} else {
		int m = (l + r) >> 1;

		if (rm <= m) {
			return go(2 * it, l, m, lm, rm);
		} else if (lm > m) {
			return go(2 * it + 1, m + 1, r, lm, rm);
		} else {
			return merg(go(2 * it, l, m, lm, m), go(2 * it + 1, m + 1, r, m + 1, rm));
		}
	}
}

int x[maxn];
int p[maxn];
int l[maxn], r[maxn];

int main() {
	int n, m, c;

	cin >> n >> m >> c;

	for (int i = 0; i < n; i++) {
		scanf("%d", &x[i]);
	}

	for (int i = 0; i < n - 1; i++) {
		scanf("%d", &p[i]);
	}

	for (int i = 0; i < m; i++) {
		int lm, rm;

		scanf("%d %d", &lm, &rm);
		lm--;
		rm--;

		change(1, 0, n - 1, lm, rm - 1, 1);

		l[i] = lm;
		r[i] = rm - 1;
	}

	make(1, 0, n - 1);

	for (int i = 0; i < n - 1; i++) {
		z[i] = (50 * (x[i + 1] - x[i]) - p[i] * c);
	}

	build(1, 0, n - 2);

	ll ans = 0;

	for (int i = 0; i < m; i++) {
		pair <pll, pll> f = go(1, 0, n - 2, l[i], r[i]);

		ans += f.second.second;
	}

	printf("%.10lf\n", (double)ans / 100);

	return 0;
}


#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rr(random_device{}());

const double EPS = 1e-9;

class SegmentTree {
private:
    struct Node {
        double pref;
        bool fPref;
        double suff;
        bool fSuff;
        double ans;
    };

public:
    SegmentTree() {};
    SegmentTree(int n) : n(n) {
        nd.resize(4 * n);
    };

    SegmentTree(const vector<double> &arr) {
        n = sz(arr);
        nd.resize(4 * n);
        buildTree(0, 0, n, arr);
    }

    double get(int l, int r) {
        return get(0, 0, n, l, r).ans;
    }

private:
    void buildTree(int v, int l, int r, const vector<double> &arr) {
        if (r - l == 1) {
            if (arr[l] > -EPS) {
                nd[v] = {arr[l], true, arr[l], true, arr[l]};
            } else {
                nd[v] = {0., false, 0., false, 0.};
            }
        } else {
            int mid = (l + r) / 2;
            buildTree(2 * v + 1, l, mid, arr);
            buildTree(2 * v + 2, mid, r, arr);
            nd[v] = merge(nd[2 * v + 1], nd[2 * v + 2]);
        }
    }

    Node merge(const Node &u, const Node &w) {
        Node res = {u.pref, false, w.suff, false, 0.};

        if (u.fPref && u.pref + w.pref > res.pref - EPS) {
            res.pref = u.pref + w.pref;
            if (w.fPref)
                res.fPref = true;
        }

        if (w.fSuff && w.suff + u.suff > res.suff - EPS) {
            res.suff = w.suff + u.suff;
            if (u.fSuff)
                res.fSuff = true;
        }

        res.ans = max({u.ans, w.ans, u.suff + w.pref});

        return res;
    }

    Node get(int v, int lf, int rg, int l, int r) {
        // cout << lf << " " << rg << " " << l  << " " << r << endl;

        if (r <= lf || rg <= l)
            return {0., true, 0., true, 0.};

        if (l <= lf && rg <= r)
            return nd[v];

        int mid = (lf + rg) / 2;
        Node u = get(2 * v + 1, lf, mid, l, r);
        Node w = get(2 * v + 2, mid, rg, l, r);
        return merge(u, w);
    }

    int n;
    vector<Node> nd;
};

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, c;
    cin >> n >> m >> c;
    vector<double> x(n);
    for (int i = 0; i < n; ++i)
        cin >> x[i];

    vector<double> p(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        cin >> p[i];
        p[i] /= 100;
    }

    vector<double> arr(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        arr[i] = (x[i + 1] - x[i]) / 2 - c * p[i];
    }

    SegmentTree tree(arr);

    double ans = 0;
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        // cout << "!" << l << " " << r << endl;
        --l; --r;
        ans += tree.get(l, r);
    }

    cout.precision(12);
    cout << fixed;
    cout << ans << endl;

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rr(random_device{}());

const double EPS = 1e-9;

class SegmentTree {
private:
    struct Node {
        double pref;
        double suff;
        double sum;
        double ans;
    };

public:
    SegmentTree() {};
    SegmentTree(int n) : n(n) {
        nd.resize(4 * n);
    };

    SegmentTree(const vector<double> &arr) {
        n = sz(arr);
        nd.resize(4 * n);
        buildTree(0, 0, n, arr);
    }

    double get(int l, int r) {
        return get(0, 0, n, l, r).ans;
    }

private:
    void buildTree(int v, int l, int r, const vector<double> &arr) {
        if (r - l == 1) {
            if (arr[l] > -EPS) {
                nd[v] = {arr[l], arr[l], arr[l], arr[l]};
            } else {
                nd[v] = {0., 0., arr[l], 0.};
            }
        } else {
            int mid = (l + r) / 2;
            buildTree(2 * v + 1, l, mid, arr);
            buildTree(2 * v + 2, mid, r, arr);
            nd[v] = merge(nd[2 * v + 1], nd[2 * v + 2]);
        }
    }

    Node merge(const Node &u, const Node &w) {
        Node res = {u.pref, w.suff, u.sum + w.sum, 0.};
        res.pref = max(res.pref, u.sum + w.pref);
        res.suff = max(res.suff, u.suff + w.sum);
        res.ans = max({u.ans, w.ans, u.suff + w.pref});
        return res;
    }

    Node get(int v, int lf, int rg, int l, int r) {
        // cout << lf << " " << rg << " " << l  << " " << r << endl;

        if (r <= lf || rg <= l)
            return {0., 0., 0., 0.};

        if (l <= lf && rg <= r)
            return nd[v];

        int mid = (lf + rg) / 2;
        Node u = get(2 * v + 1, lf, mid, l, r);
        Node w = get(2 * v + 2, mid, rg, l, r);
        return merge(u, w);
    }

    int n;
    vector<Node> nd;
};

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, c;
    cin >> n >> m >> c;
    vector<double> x(n);
    for (int i = 0; i < n; ++i)
        cin >> x[i];

    vector<double> p(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        cin >> p[i];
        p[i] /= 100;
    }

    vector<double> arr(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        arr[i] = (x[i + 1] - x[i]) / 2 - c * p[i];
    }

    SegmentTree tree(arr);

    double ans = 0;
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        // cout << "!" << l << " " << r << endl;
        --l; --r;
        ans += tree.get(l, r);
    }

    cout.precision(12);
    cout << fixed;
    cout << ans << endl;

    return 0;
}


#include <stdio.h>
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <ctime>
#include <cassert>
#include <unordered_map>
#include <fstream>
#include <random>
#include <cstring>
#include <complex>
#include <bitset>

#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back

using namespace std;

typedef long long ll;
typedef long double ld;
mt19937 rr(random_device{}());

const double EPS = 1e-9;

class SegmentTree {
private:
    struct Node {
        double pref;
        bool fPref;
        double suff;
        bool fSuff;
        double ans;
    };

public:
    SegmentTree() {};
    SegmentTree(int n) : n(n) {
        nd.resize(4 * n);
    };

    SegmentTree(const vector<double> &arr) {
        n = sz(arr);
        nd.resize(n);
        buildTree(0, 0, n, arr);
    }

    double get(int l, int r) {
        return get(0, 0, n, l, r).ans;
    }

private:
    void buildTree(int v, int l, int r, const vector<double> &arr) {
        if (r - l == 1) {
            if (arr[l] > -EPS) {
                nd[v] = {arr[l], true, arr[l], true, arr[l]};
            } else {
                nd[v] = {0., false, 0., false, 0.};
            }
        } else {
            int mid = (l + r) / 2;
            buildTree(2 * v + 1, l, mid, arr);
            buildTree(2 * v + 2, mid, r, arr);
            nd[v] = merge(nd[2 * v + 1], nd[2 * v + 2]);
        }
    }

    Node merge(const Node &u, const Node &w) {
        Node res = {u.pref, false, w.suff, false, 0.};

        if (u.fPref && u.pref + w.pref > res.pref - EPS) {
            res.pref = u.pref + w.pref;
            if (w.fPref)
                res.fPref = true;
        }

        if (w.fSuff && w.suff + u.suff > res.suff - EPS) {
            res.suff = w.suff + u.suff;
            if (u.fSuff)
                res.fSuff = true;
        }

        res.ans = max({u.ans, w.ans, u.suff + w.pref});

        return res;
    }

    Node get(int v, int lf, int rg, int l, int r) {
        // cout << lf << " " << rg << " " << l  << " " << r << endl;

        if (r <= lf || rg <= l)
            return {0., true, 0., true, 0.};

        if (l <= lf && rg <= r)
            return nd[v];

        int mid = (lf + rg) / 2;
        Node u = get(2 * v + 1, lf, mid, l, r);
        Node w = get(2 * v + 2, mid, rg, l, r);
        return merge(u, w);
    }

    int n;
    vector<Node> nd;
};

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, m, c;
    cin >> n >> m >> c;
    vector<double> x(n);
    for (int i = 0; i < n; ++i)
        cin >> x[i];

    vector<double> p(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        cin >> p[i];
        p[i] /= 100;
    }

    vector<double> arr(n - 1);
    for (int i = 0; i < n - 1; ++i) {
        arr[i] = (x[i + 1] - x[i]) / 2 - c * p[i];
    }

    SegmentTree tree(arr);

    double ans = 0;
    for (int i = 0; i < m; ++i) {
        int l, r;
        cin >> l >> r;
        // cout << "!" << l << " " << r << endl;
        --l; --r;
        ans += tree.get(l, r);
    }

    cout.precision(12);
    cout << fixed;
    cout << ans << endl;

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <cstring>

#define Rep(i, n) for (int i = 1; i <= n; i ++)
#define Rep0(i, n) for (int i = 0; i <= n; i ++)
#define RepG(i, x) for (int i = head[x]; i; i = edge[i].next)
#define v edge[i].to
#define mp(a, b) make_pair(a, b)

using namespace std;

typedef double D;
const int N = 300010;

int x[N], lx[N], n, m, c, p[N];
struct T{ D ml, mr, mx, sum;} t[N * 4];

void up(T &a, T lc, T rc)
{
	a.sum = lc.sum + rc.sum;
	a.ml = max(lc.ml, lc.sum + rc.ml);
	a.mr = max(rc.mr, rc.sum + lc.mr);
	a.mx = max(max(lc.mx, rc.mx), lc.mr + rc.ml);
}

void build(int x, int l, int r)
{
	if (l == r) {
		D tmp = 1.0 * lx[l] / 2 - 1.0 * c * p[l] / 100;
		t[x].sum = tmp;
		t[x].ml = t[x].mr = t[x].mx = max(0.0, tmp);
	//	printf("%d %lf\n", l, tmp);
		return;
	}
	int mid = (l + r) >> 1;
	build(x << 1, l, mid); build(x << 1 | 1, mid + 1, r);
	up(t[x], t[x << 1], t[x << 1 | 1]);
}

T query(int x, int l, int r, int a, int b)
{
	if (a <= l && r <= b) return t[x];
	int mid = (l + r) >> 1;
	T ret, tmp1 = (T){-1e9, -1e9, -1e9, -1e9}, tmp2 = (T){-1e9, -1e9, -1e9, -1e9};
	if (a <= mid) tmp1 = query(x << 1, l, mid, a, b);
	if (b > mid) tmp2 = query(x << 1 | 1, mid + 1, r, a, b);
	up(ret, tmp1, tmp2);
	return ret;
}

int main()
{
	scanf("%d%d%d", &n, &m, &c);
	Rep(i, n) scanf("%d", &x[i]);
	Rep(i, n - 1){
		scanf("%d", &p[i]);
		lx[i] = x[i + 1] - x[i];
	}
	build(1, 1, n - 1);
	D ans = 0;
	Rep(i, m) {
		int a, b;
		scanf("%d%d", &a, &b);
		b --;
		ans += query(1, 1, n - 1, a, b).mx;
	}
	printf("%.8lf", ans);

	return 0;
}


#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = a; i < b; ++i)
#define all(c) c.begin(), c.end()
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define gadd(x,y) x=add(x,y)
#define gmul(x,y) x=mul(x,y)
using namespace std;

typedef pair<int,int> pii;
typedef long long ll;

const int N = 2e5;

int del[N];

struct seg {
	struct node {
		double maxl,maxr,maxv,sum;
		node(){

		}
		node(double v){
			maxl = maxr = maxv = sum = v;
			gmax(maxl,0.0);
			gmax(maxr,0.0);
			gmax(maxv,0.0);
		}
		node(double a, double b, double c, double d){
			maxl=a;
			maxr=b;
			maxv=c;
			sum=d;
		}
	};
	node f(node &a, node &b){
		node res = node(max(a.maxl,a.sum + b.maxl), max(b.maxr,b.sum + a.maxr),
		max(max(a.maxv,b.maxv), a.maxr + b.maxl),a.sum + b.sum);
		return res;
	}
	node t[2*N];
	int n;
	seg(int n) : n(n){}
	void edit(int x,double val){
		x+=n;
		t[x] = node(val);
		while(x>1){
			x/=2;
			t[x] = f(t[x*2],t[x*2+1]);
		}
	}
	node query(int l, int r){
		node resr = node(0), resl = node(0);
		for(l+=n,r+=n; l < r; l/=2,r/=2){
			if(l&1)resl = f(resl, t[l++]);
			if(r&1)resr = f(t[--r], resr);
		}
		return f(resl,resr);
	}
};

int main(){
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n,m,c;
	cin >> n >> m >> c;
	--n;
	vector<int> v(n);
	vector<double> p(n);
	int pri;cin >> pri;
	rep(i,0,n){
		int x;
		cin >> x;
		v[i] = x - pri;
		pri = x;
	}
	seg tree(n);
	rep(i,0,n){
		cin >> p[i];
		p[i]/=100;
	}
	rep(i,0,n){
		tree.edit(i,(double(v[i])/2.0 - double(c) * p[i]));
	}
	double ans = 0;
	rep(i,0,m){
		int x,y;
		cin >> x >> y;
		ans += tree.query(--x,--y).maxv;
	}
	cout.precision(13);
	cout << ans << '\n';
}


#include <bits/stdc++.h>
#define mid (r + l >> 1)
#define ls (u << 1)
#define rs (ls | 1)
#define NN 150100
using namespace std;
typedef long long INT;

int x[NN];
int n, m;
double c;
double p[NN], sum[NN<<2], mn[NN<<2], mx[NN<<2], sm[NN];

void push_up(int u){
	mn[u] = min(mn[ls], mn[rs]);
	mx[u] = max(mx[ls], mx[rs]);
	sum[u] = max(mx[rs] - mn[ls], max(sum[ls], sum[rs]));
}

void build(int u, int l, int r){
	if(l + 1 == r) {
		mn[u] = sm[l - 1];
		mx[u] = sm[l - 1];
		sum[u] = 0;
		return ;
	}
	build(ls, l, mid);
	build(rs, mid, r);
	push_up(u);
}
double answ, CC;
void calc(int u, int l, int r, int st, int ed){
	if(r <= st || l >= ed) return ;
	if(l >= st && r <= ed) {
		answ = max(answ, sum[u]);
		answ = max(answ, mx[u] - CC);
		CC = min(CC, mn[u]);
		return ;
	}
	calc(ls, l, mid, st, ed);
	calc(rs, mid, r, st, ed);
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	scanf("%d%d%lf", &n, &m, &c);
	c /= 100;
	for(int i = 1; i <= n; i++) scanf("%d", &x[i]);
	for(int i = 1; i < n; i++) scanf("%lf", &p[i]);
	sm[0] = (double)x[0] / 2;
	for(int i = 1; i < n; i++) {
		sm[i] = sm[i - 1] + (double)(x[i + 1] - x[i]) / 2;
		sm[i] -= p[i] * c;
	}
	build(1, 1, n + 1);
	double ans = 0;
	for(int i = 1; i <= m; i++){
		int st, ed;
		answ = 0, CC = 1e9;
		scanf("%d%d", &st, &ed);
		calc(1, 1, n + 1, st, ed + 1);
		ans += answ;
	}
	printf("%.9lf\n", ans);
	return 0;
}


#include<bits/stdc++.h>

#define NN 160000
#define ls (u<<1)
#define rs ls|1
#define mid (l+r>>1)
#define inf 0x3f3f3f3f3f3f

using namespace std;

typedef long long INT;

int x[NN],p[NN];
double mx[NN<<2],mi[NN<<2],d[NN<<2];
double s[NN];

void push_up(int u){
	mx[u]=max(mx[ls],mx[rs]);
	mi[u]=min(mi[ls],mi[rs]);
	d[u]=max(d[ls],d[rs]);
	d[u]=max(d[u],mx[rs]-mi[ls]);
}

void build(int u,int l,int r){
	if(l+1==r){
		mx[u]=s[l];
		mi[u]=s[l];
		d[u]=0;
		return ;
	}
	build(ls,l,mid);
	build(rs,mid,r);
	push_up(u);
}

double ct,mn;

void calc(int u,int l,int r,int st,int ed){
	if(l>=ed or st>=r)return ;
	if(l>=st and r<=ed){
		ct=max(ct,d[u]);
		ct=max(ct,mx[u]-mn);
		mn=min(mn,mi[u]);
		return ;
	}
	calc(ls,l,mid,st,ed);
	calc(rs,mid,r,st,ed);
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n,m,c;
	cin>>n>>m>>c;
	for(int i=1;i<=n;i++)scanf("%d",&x[i]);
	for(int i=1;i<n;i++)scanf("%d",&p[i]);

	for(int i=2;i<=n;i++)s[i]=s[i-1]+(x[i]-x[i-1])/2.0-(double)c*p[i-1]/100;
	build(1,1,n+1);

	double ans=0;

	while(m--){
		int st,ed;
		scanf("%d %d",&st,&ed);
		ct=0;
		mn=inf;
		calc(1,1,n+1,st,ed+1);
		ans+=ct;
	}

	printf("%.10lf\n",ans);

	return 0;
}


#include <bits/stdc++.h>
#define mid (r + l >> 1)
#define ls (u << 1)
#define rs (ls | 1)
#define NN 100100
using namespace std;
typedef long long INT;

int x[NN];
int n, m;
double c;
double p[NN], sum[NN<<2], mn[NN<<2], mx[NN<<2], sm[NN];

void push_up(int u){
	mn[u] = min(mn[ls], mn[rs]);
	mx[u] = max(mx[ls], mx[rs]);
	sum[u] = max(mx[rs] - mn[ls], max(sum[ls], sum[rs]));
}

void build(int u, int l, int r){
	if(l + 1 == r) {
		mn[u] = sm[l - 1];
		mx[u] = sm[l - 1];
		sum[u] = 0;
		return ;
	}
	build(ls, l, mid);
	build(rs, mid, r);
	push_up(u);
}
double answ, CC;
void calc(int u, int l, int r, int st, int ed){
	if(r <= st || l >= ed) return ;
	if(l >= st && r <= ed) {
		answ = max(answ, sum[u]);
		answ = max(answ, mx[u] - CC);
		CC = min(CC, mn[u]);
		return ;
	}
	calc(ls, l, mid, st, ed);
	calc(rs, mid, r, st, ed);
}

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif

	scanf("%d%d%lf", &n, &m, &c);
	c /= 100;
	for(int i = 1; i <= n; i++) scanf("%d", &x[i]);
	for(int i = 1; i < n; i++) scanf("%lf", &p[i]);
	sm[0] = (double)x[0] / 2;
	for(int i = 1; i < n; i++) {
		sm[i] = sm[i - 1] + (double)(x[i + 1] - x[i]) / 2;
		sm[i] -= p[i] * c;
	}
	build(1, 1, n + 1);
	double ans = 0;
	for(int i = 1; i <= m; i++){
		int st, ed;
		answ = 0, CC = 1e9;
		scanf("%d%d", &st, &ed);
		calc(1, 1, n + 1, st, ed + 1);
		ans += answ;
	}
	printf("%.9lf\n", ans);
	return 0;
}


#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,m,c,x[153600],a,b,p,u[128];
long long s,h[153600],y,z;
struct xx{long long l,m,r;} t[153600<<2],d;
#define L t[k<<1]
#define R t[k<<1|1]
void build(int k,int l,int r){
 if(l+1<r){
  int m=(l+r)>>1;
  build(k<<1,l,m);
  build(k<<1|1,m,r);
  t[k].m=max(L.r+R.l,max(L.m,R.m));
  t[k].l=max(L.l,R.l+h[m]-h[l]);
  t[k].r=max(R.r,L.r+h[r]-h[m]);
 }else t[k].l=t[k].m=t[k].r=max(0ll,h[r]-h[l]);
}
void qury(int k,int l,int r){
 if(l>=a && r<=b){
  if(~d.m){
   d.m=max(d.m,max(t[k].m,d.r+t[k].l));
   d.l=max(d.l,s+t[k].l);
   d.r=max(t[k].r,d.r+h[r]-h[l]);
   s+=h[r]-h[l];
  }else d=t[k],s=h[r]-h[l];
 }else{
  int m=(l+r)>>1;
  if(m>a)qury(k<<1,l,m);
  if(m<b)qury(k<<1|1,m,r);
 }
}
int main(){
 scanf("%d%d%d",&n,&m,&c);--n;
 for(int i=0;i<=n;++i)scanf("%d",x+i);
 for(int i=0;i<n;++i)
  scanf("%d",&p),
  h[i+1]=h[i]+(x[i+1]-x[i])*50ll-1ll*p*c;
 build(1,0,n);
 while(m--){
  scanf("%d%d",&a,&b);
  --a,--b,d.m=-1;
  qury(1,0,n);
  y+=d.m;
 }
 printf("%.8lf\n",y*0.01);
 return 0;
}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==0|| b==0)
        {
            cout<<0<<endl;
        }
        else if(a*2<=b || b*2<=a)
        {
            cout<<min(a,b)<<endl;
        }
        else if(a==b)
        {
            cout<<a/2<<endl;
        }
        else
        {
            int coto=min(a,b);
            int boro=max(a,b);
            int diff=boro-coto,ans=0;
            if(diff==1)
            {
                cout<<(boro+coto)/3<<endl;
            }
            else
            {
                ans+=(diff-1);
                boro-=(diff-1)*2;
                coto-=(diff-1);
                ans+=((boro+coto)/3);
                cout<<ans<<endl;

            }

        }

    }

}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==0|| b==0)
        {
            cout<<0<<endl;
        }
        else if(a*2<=b || b*2<=a)
        {
            cout<<min(a,b)<<endl;
        }
        else if(a==b)
        {
            cout<<a/2<<endl;
        }
        else
        {
            int coto=min(a,b);
            int boro=max(a,b);
            cout<<(coto+boro)/3<<endl;

        }

    }

}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==0|| b==0)
        {
            cout<<0<<endl;
        }
        else if(a*2<=b || b*2<=a)
        {
            cout<<min(a,b)<<endl;
        }
        else if(a==b)
        {
            cout<<a/2<<endl;
        }
        else
        {
            int cnt=0;
            if(a<b)
            {
               int temp=a;
               a=b;
               b=temp;

            }
            int i=0;
            while(1)
            {
                i++;
                if(i%2==0)
                {
                    cnt++;
                    a--;
                    b-=2;
                    if(a==0 || b==0)
                        break;
                }
                else
                {
                    cnt++;
                    a-=2;
                    b--;
                    if(a==0 || b==0)
                        break;
                }
            }
            cout<<cnt<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        cout<<min(a,min(b,(a+b)/3))<<endl;

    }
}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==0|| b==0)
        {
            cout<<0<<endl;
        }
        else if(a*2<=b || b*2<=a)
        {
            cout<<min(a,b)<<endl;
        }
        else if(a==b)
        {
            cout<<a/2<<endl;
        }
        else
        {
            int coto=min(a,b);
            int boro=max(a,b);
            int diff=boro-coto,ans=0;
            if(diff==1)
            {
                cout<<(boro+coto)/3<<endl;
            }
            else
            {
                if(diff>coto)
                {
                    cout<<coto<<endl;
                }
                else
                {
                    ans+=(diff-1);
                boro-=(diff-1)*2;
                coto-=(diff-1);
                ans+=((boro+coto)/3);
                cout<<ans<<endl;
                }

            }

        }

    }

}


#include<bits/stdc++.h>

#define ll                   long long int
#define gcd(a,b)              __gcd(a,b)
#define lcm(a,b)             (a*b)/gcd(a,b)
#define PI                    2*acos(0.0)

/*-------------------------------Print---------------------------------------*/

#define YES                  cout<<"YES"<<endl
#define NO                   cout<<"NO"<<endl
#define yes                  cout<<"yes"<<endl
#define no                   cout<<"no"<<endl

using namespace std;

int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        if(a==0|| b==0)
        {
            cout<<0<<endl;
        }
        else if(a*2<=b || b*2<=a)
        {
            cout<<min(a,b)<<endl;
        }
        else if(a==b)
        {
            cout<<a/2<<endl;
        }
        else
        {
            cout<<(a+b)/3<<endl;
        }
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b;
cin>>t;
while(t--)
{
   cin>>a>>b;
   if(min(a,b)<1 || max(a,b)<2)
        cout<<0<<endl;
   else
    cout<<min((a+b)/3,min((a/2)*2,(b/2)*2))<<endl;
}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b;
cin>>t;
while(t--)
{
   cin>>a>>b;
   if(min(a,b)<1 || max(a,b)<2)
        cout<<0<<endl;
   else
    cout<<(a+b)/3<<endl;
}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b,e,k,l,i,m;
cin>>t;
while(t--)
{
   cin>>a>>b;
   k=max(a,b);
  m=0;
   l=min(a,b);
   b=k;
   a=l;
   if(min(a,b)<1)
    cout<<0<<endl;
   else
   {
       for(i=a;i>=1;i--)
   {
    if(i*2<=b)
    {
        if((b-(i*2))*2<=(a-i))
            m=max((i+(b-(i*2))),m);
        else
           m=max(i,m);
    }
   }
   cout<<m<<endl;
   }

}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b,e,k,l,i;
cin>>t;
while(t--)
{
   cin>>a>>b;
   k=max(a,b);
   vector<ll> v;
   l=min(a,b);
   b=k;
   a=l;
   if(min(a,b)<1)
    cout<<0<<endl;
   else
   {
       for(i=a;i>=1;i--)
   {
    if(i*2<=b)
    {
        if((b-(i*2))*2<=(a-i))
            v.pb(i+(b-(i*2)));
        else
            v.pb(i);
    }
   }
   cout<<*max_element(v.begin(),v.end())<<endl;
   }

}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b,e,k,l,i,m;
cin>>t;
while(t--)
{
   cin>>a>>b;
   k=max(a,b);
  m=0;
   l=min(a,b);
   b=k;
   a=l;
   if(min(a,b)<1)
    cout<<0<<endl;
   else
   {
       if(a*2<=b)
        cout<<a<<endl;
       else
       {
           m=m+(a/2)+min((a-a/2)/2,b-((a/2)*2));
           cout<<m<<endl;

       }
   }

}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b,e,k,l,i,m;
cin>>t;
while(t--)
{
   cin>>a>>b;
   k=max(a,b);
  m=0;
   l=min(a,b);
   b=k;
   a=l;
   if(min(a,b)<1)
    cout<<0<<endl;
   else
   {
       if(a*2<=b)
        cout<<a<<endl;
       else
       {
           m=(a+b)/4+min((a-(a+b)/4)/2,b-(((a+b)/4)*2));
           cout<<m<<endl;

       }
   }

}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b;
cin>>t;
while(t--)
{
   cin>>a>>b;
   if(min(a,b)<1&&max(a,b)<2)
        cout<<0<<endl;
   else
    cout<<(a+b)/3<<endl;
}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b;
cin>>t;
while(t--)
{
   cin>>a>>b;
   if(min(a,b)<1)
        cout<<0<<endl;
   else
    cout<<(a+b)/3<<endl;
}
}


#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define PI          3.141592653589793
//to_string(i) used for converting i to string
//x<<y mutiplies x*pow(2,y)
using namespace std;
ll expo(ll x,ll n,ll p)
{
    if(n==0)
        return 1%p;
    ll ans=1,base=x;
    while(n>0)
    {

        if(n%2==1)
        {
            ans=(ans*base)%p;
            n--;
        }
        else
        {
            base=(base*base)%p;
            n/=2;
        }
    }
    if(ans<0)
        ans=(ans+p)%p;

    return ans;
}
void isort(ll a[],ll n)
{

    ll i,v,j;
    for(i=1;i<=n-1;i++)
    {
        v=a[i];
        j=i;
        while(j>0&&a[j-1]>v)
            {a[j]=a[j-1];
            j--;
            }
        a[j]=v;
    }
}
void merg(ll a[],ll s, ll m,ll e)
{
    ll b[e-s+1];
    ll i=s,j=m+1,k=0;
    while(i<=m && j<=e)
    {
        if(a[i]<=a[j])
        {
            b[k]=a[i];
            k++;
            i++;
        }
        else
        {
            b[k]=a[j];
            k++;
            j++;
        }
    }
    while(i<=m)
    {
      b[k]=a[i];
            k++;
            i++;
    }
    while(j<=e)
    {
        b[k]=a[j];
            k++;
            j++;
    }
    for(i=s;i<=e;i++)
        a[i]=b[i-s];
}
void msort(ll a[],ll s ,ll e)
{
    if(s<e)
    {
        ll m=(s+e)/2;
        msort(a,s,m);
        msort(a,m+1,e);
        merg(a,s,m,e);
    }

}
ll parti(ll a[],ll s,ll e)
{
    ll pi=a[e],i,p;
    p=s;
    for(i=s;i<e;i++)
    {
        if(a[i]<=pi)
        {
            swap(a[p],a[i]);
            p++;
        }
    }
    swap(a[e],a[p]);
    return p;

}
void qsort(ll a[],ll s,ll e)
{
    if(s>=e)
        return ;
    ll p=parti(a,s,e);
    qsort(a,s,p-1);
    qsort(a,p+1,e);
}
ll power(ll x,ll y)
{
    ll k=1;
    while(y--)
    {
        k=k*x;
    }
    return k;
}
int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
ll t,a,b;
cin>>t;
while(t--)
{
   cin>>a>>b;
   if(min(a,b)<1 || max(a,b)<2)
        cout<<0<<endl;
   else
    cout<<(min(min(a,b)*2,max(a,b))+min(a,b))/3<<endl;
}
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s!=0&&d!=0&&(s!=1&&d!=1))
        {
        if(s==d)
        {
            c+=(s+d)/3;
        }
        else if(s>d)
        {
           if(s/2>d)
           {
               c+=d;
               d=0;
           }
           else
           {
               c+=s/2;
               s%=2;
               d-=s/2;
           }

        }
        else
        {
            if(d/2>s)
            {
                c+=s;
                s=0;
            }
            else
            {
                c+=d/2;
                d%=2;
                s-=d/2;
            }
        }
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(1)
        {
            if(s==0||d==0||(s==1&&d==1))
             break;
            if(s==d)
            {
                c+=(s+d)/3;
                break;
            }
            else if(s>d)
            {
                s-=2;
                d-=1;
                c++;
            }
            else
            {
                d-=2;
                s-=1;
                c++;
            }
        }
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        if(s==0||d==0||(s==1&&d==1))
         cout<<0<<"\n";
        else if(s==d)
        {
            c=(s+d)/3;
        }
        else if(s>d)
        {
            c=s/2;
            if(c>d)
            {
                c=d;
            }
        }
        else
        {
            c=d/2;
            if(c>s)
             c=s;
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s!=0&&d!=0&&(s!=1&&d!=1))
        {
        if(s==d)
        {
            c+=(s+d)/3;
        }
        else if(s>d)
        {
           if(s/2>d)
           {
               c+=d
               d=0;
           }
           else
           {
               c+=s/2;
               s%=2;
               d-=s/2;
           }

        }
        else
        {
            if(d/2>s)
            {
                c+=s;
                s=0;
            }
            else
            {
                c+=d/2;
                d%=2;
                s-=d/2;
            }
        }
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        if(s==0||d==0||(s==1&&d==1))
         cout<<0<<"\n";
        if(s==d)
        {
            c=(s+d)/3;
        }
        else if(s>d)
        {
            c=s/2;
            if(c>d)
            {
                c=d;
            }
        }
        else
        {
            c=d/2;
            if(c>s)
             c=s;
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        if(s==0||d==0||(s==1&&d==1))
         c=0;
        else if(s==d)
        {
            c=(s+d)/3;
        }
        else if(s>d)
        {
            c=s/2;
            if(c>d)
            {
                c=d;
            }
        }
        else
        {
            c=d/2;
            if(c>s)
             c=s;
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(1)
        {
            if(s==0||d==0||(d==1&&s==1))
             break;
            if(s>=d)
            {
                s-=2;
                d-=1;
                c++;
            }
            else
            {
                d-=2;
                s-=1;
                c++;
            }
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s!=0||d!=0||(s!=1&&d!=1))
        {
        if(s==d)
        {
            c+=(s+d)/3;
        }
        else if(s>d)
        {
           if(s/2>d)
           {
               c+=d
               d=0;
           }
           else
           {
               c+=s/2;
               s%=2;
               d-=s/2;
           }

        }
        else
        {
            if(d/2>s)
            {
                c+=s;
                s=0;
            }
            else
            {
                c+=d/2;
                d%=2;
                s-=d/2;
            }
        }
        }
        cout<<c<<"\n";
    }
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        c=min((a+b)/3,min(a,b));
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s>0&&d>0&&(s!=1&&d!=1))
        {
            if(s==d)
            {
                c+=(s+d)/3;
                break;
            }
            else if(s>d)
            {
                s-=2;
                d-=1;
                c++;
            }
            else
            {
                d-=2;
                s-=1;
                c++;
            }
        }
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s>0&&d>0&&(s!=1&&d!=1))
        {
            if(s==d)
            {
                c+=(s+d)/3;
                break;
            }
            else if(s>d)
            {
                if(s/2>d)
                {
                    c+=d;
                    d=0;
                }
                else
                {
                    c+=s/2;
                    s%=2;
                    d-=s/2;
                }
            }
            else
            {
                if(d/2>s)
                {
                    c+=s;
                    s=0;
                }
                else
                {
                    c+=d/2;
                    d%=2;
                    s-=d/2;
                }
            }
        }
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll a,b,c=0;
        cin>>a>>b;
        c=min((a+b)/3,min(a,b));
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(1)
        {
            if(s==0||d=0||(s==1&&d==1))
             break;
            if(s==d)
            {
                c+=(s+d)/3;
                break;
            }
            else if(s>d)
            {
                s-=2;
                d-=1;
                c++;
            }
            else
            {
                d-=2;
                s-=1;
                c++;
            }
        }
        cout<<c<<"\n";
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s!=0||d!=0||(s!=1&&d!=1))
        {
        if(s==d)
        {
            c+=(s+d)/3;
        }
        else if(s>d)
        {
           if(s/2>d)
           {
               c+=d;
               d=0;
           }
           else
           {
               c+=s/2;
               s%=2;
               d-=s/2;
           }

        }
        else
        {
            if(d/2>s)
            {
                c+=s;
                s=0;
            }
            else
            {
                c+=d/2;
                d%=2;
                s-=d/2;
            }
        }
        }
        cout<<c<<"\n";
    }
}


#define<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        ll s,d,c=0;
        cin>>s>>d;
        while(s>0&&d>0&&(s!=1&&d!=1))
        {
            if(s==d)
            {
                c+=(s+d)/3;
                break;
            }
            else if(s>d)
            {
                if(s/2>d)
                {
                    c+=d;
                    d=0;
                }
                else
                {
                    c+=s/2;
                    s%=2;
                    d-=s/2;
                }
            }
            else
            {
                if(d/2>s)
                {
                    c+=s;
                    s=0;
                }
                else
                {
                    c+=d/2;
                    d%=2;
                    s-=d/2;
                }
            }
        }
        cout<<c<<"\n";
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if((sticks==0 || diamonds==0) || (sticks==1 && diamonds==1))
        {
            cout<<0<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds-=(sticks-diamonds);
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if(sticks==0 || diamonds==0)
        {
            cout<<0<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds-=(sticks-diamonds);
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                // f-=3;
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            // for(ll i=0;;i+=3)
            // {
            //     if(i>=sticks)
            //     {
            //         f=i;
            //         break;
            //     }
            // }
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                // f-=3;
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if(sticks==0 || diamonds==0)
        {
            cout<<0<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds-=(sticks-diamonds);
            for(ll i=0;;i+=3)
            {
                if(i>=sticks)
                {
                    f=i;
                    break;
                }
            }
            if(f==sticks) ans+=(sticks/3)*2;
            else
            {
                f-=3;
                if(f==1) ans+=((sticks-1)/3) * 2;
                else if(f==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            for(ll i=0;;i+=3)
            {
                if(i>=sticks)
                {
                    f=i;
                    break;
                }
            }
            if(f==sticks) ans=(sticks/3)*2;
            else
            {
                f-=3;
                if(f==sticks-1) ans+=((sticks-1)/3) * 2;
                else if(f==sticks-2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if((sticks==0 || diamonds==0) || (sticks==1 && diamonds==1))
        {
            cout<<0<<"\n";
            continue;
        }
        if(sticks==2 && diamonds==2)
        {
            cout<<1<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds+=(sticks-diamonds);

            if(sticks==2 && diamonds==2)
            {
                ans+=1;
                cout<<ans<<"\n";
                continue;
            }
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans=((sticks-2)/3)*2 + 1;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if((sticks==0 || diamonds==0) || (sticks==1 && diamonds==1))
        {
            cout<<0<<"\n";
            continue;
        }
        if(sticks==2 && diamonds==2)
        {
            cout<<1<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds+=(sticks-diamonds);

            if(sticks==2 && diamonds==2)
            {
                ans+=1;
                cout<<ans<<"\n";
                continue;
            }
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2 + 1;
            }
        }
        else if(sticks==diamonds)
        {
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans=((sticks-2)/3)*2 + 1;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if((sticks==0 || diamonds==0) || (sticks==1 && diamonds==1))
        {
            cout<<0<<"\n";
            continue;
        }
        if(sticks==2 && diamonds==2)
        {
            cout<<1<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds-=(sticks-diamonds);
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if((sticks==0 || diamonds==0) || (sticks==1 && diamonds==1))
        {
            cout<<0<<"\n";
            continue;
        }
        if(sticks==2 && diamonds==2)
        {
            cout<<1<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds+=(sticks-diamonds);
            // cout<<sticks<<" "<<diamonds<<"\n";
            if(sticks==2 && diamonds==2)
            {
                ans+=1;
                cout<<ans<<"\n";
                continue;
            }
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
    	ll sticks,diamonds;
    	cin>>sticks>>diamonds;

    	if(sticks==0 || diamonds==0)
    	{
    		cout<<0<<"\n";
    		continue;
    	}
    	ll ans=0,f=0;
    	if(sticks<diamonds) f=1;

    	while(1)
    	{
    		if(!f)
    		{
    			if(sticks<diamonds) f=1;
    			ans++;
    			sticks-=2;
    			diamonds--;
    		}
    		if(sticks==0 || diamonds==0) break;

    		if(f)
    		{
    			if(diamonds<=sticks) f=0;
    			ans++;
    			sticks--;
    			diamonds-=2;
    		}
    		if(sticks==0 || diamonds==0) break;
    	}
    	cout<<ans<<"\n";
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(nullptr);

    ll t;
    cin>>t;

    while(t--)
    {
        ll sticks,diamonds;
        cin>>sticks>>diamonds;

        if(sticks==0 || diamonds==0)
        {
            cout<<0<<"\n";
            continue;
        }
        ll ans=0,f=0;
        if(sticks<diamonds) swap(sticks,diamonds);

        if(sticks>=2*diamonds) ans=diamonds;
        else if(sticks>diamonds && sticks<2*diamonds)
        {
            ans+=sticks-diamonds;
            sticks-= 2*(sticks-diamonds);
            diamonds-=(sticks-diamonds);
            if(sticks%3==0) ans+=(sticks/3)*2;
            else
            {
                // f-=3;
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }
        else if(sticks==diamonds)
        {
            // for(ll i=0;;i+=3)
            // {
            //     if(i>=sticks)
            //     {
            //         f=i;
            //         break;
            //     }
            // }
            if(sticks%3==0) ans=(sticks/3)*2;
            else
            {
                // f-=3;
                if(sticks%3==1) ans+=((sticks-1)/3) * 2;
                else if(sticks%3==2) ans+=((sticks-2)/3)*2;
            }
        }

        cout<<ans<<"\n";
    }
}


#include <iostream>
using namespace std;

int main() {
  int testCases;
  cin >> testCases;
  int answers[testCases];

  for(int i = 0; i < testCases; i++) {
    int sticks, diamonds, ans = 0;
    cin >> sticks >> diamonds;

    while(sticks != 0 && diamonds != 0) {
      if(sticks == diamonds && sticks > 0 && diamonds > 0) {
        if(sticks >= 2 && diamonds >= 1) {
          sticks -= 2;
          diamonds -= 1;
          ans++;
        }
        else {
          sticks -= 1;
          diamonds -= 2;
          ans++;
        }
        if(sticks < 0 || diamonds < 0) {
          continue;
        }
        answers[i] = ans;
        continue;
      }

      if(sticks > diamonds) {
        sticks -= 2;
        diamonds -= 1;
        ans++;
      }
      else if(sticks == diamonds) {
        sticks -= 2;
        diamonds -= 1;
        ans++;
      }
      else {
        sticks -= 1;
        diamonds -= 2;
        ans++;
      }
    }

    answers[i] = ans;
  }

  for(int i = 0; i < testCases; i++) {
    cout << answers[i] << endl;
  }

  return 0;
}


#include <iostream>
using namespace std;

int main() {
  int testCases;
  cin >> testCases;
  int answers[testCases];

  for(int i = 0; i < testCases; i++) {
    int sticks, diamonds, ans = 0;
    cin >> sticks >> diamonds;

    if(diamonds > sticks) {
      while(sticks >= 1 && diamonds >= 2) {
        sticks -= 1;
        diamonds -= 2;
        ans++;
      }

      while(sticks >= 2 && diamonds >= 1) {
        sticks -= 2;
        diamonds -= 1;
        ans++;
      }
    }
    else {
      while(sticks >= 2 && diamonds >= 1) {
        sticks -= 2;
        diamonds -= 1;
        ans++;
      }

      while(sticks >= 1 && diamonds >= 2) {
        sticks -= 1;
        diamonds -= 2;
        ans++;
      }
    }

    answers[i] = ans;
  }

  for(int i = 0; i < testCases; i++) {
    cout << answers[i] << endl;
  }

  return 0;
}