#include <math.h>
#include <stdio.h>
#include <string.h>

#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

constexpr long long INFLL = 1e18;

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll x, y, a, b;
  cin >> x >> y >> a >> b;
  bool check = false;
  ll exp = 0;
  while (x < b) {
    if (x >= y) {
      x /= a;
      exp--;
      check = true;
      break;
    }
    x *= a;
    exp++;
  }
  if (check == false && x >= y) {
    x /= a;
    exp--;
  }
  if (check == false && y > x) {
    ll dif = y - x;
    ll count = dif / b;
    if (dif % b == 0 && count > 0) {
      count--;
    }
    exp += count;

    // x += b * count;
    /*
        while (x < y) {
          x += b;
          exp++;
        }
        x -= b;
        exp--;
        */
  }
  //   cout << x << endl;
  if (exp < 0) {
    exp = 0;
  }
  cout << exp << endl;
  return 0;
}
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int getRand(int l, int r)
{
    uniform_int_distribution<int> uid(l, r);
    return uid(rng);
}
  
#define int long long 
#define pb push_back
#define S second
#define F first
#define f(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define precise(x) fixed << setprecision(x) 

const int MOD = 1e9+7;

int mod_pow(int a,int b,int M = MOD)
{
    if(a == 0) return 0;
    b %= (M - 1);  //M must be prime here
    
    int res = 1;
    
    while(b > 0)
    {
        if(b&1) res=(res*a)%M;
        a=(a*a)%M;
        b>>=1;
    }
    
    return res;
}


void solve()
{
   int n,m,q;
    cin >> n >> m >> q;
    
    pii a[n];
    f(i,n) cin >> a[i].S >> a[i].F;
    sort(a,a+n);
    reverse(a,a+n);
    
    int b[m];
    f(i,m) cin >> b[i];
    
    int l,r;
    
    while(q--)
    {
        cin >> l >> r;
        l--,r--;
        
        multiset<int> ms;
        
        for(int i=0;i<m;i++)
            if(i < l || i > r) ms.insert(b[i]);
            
        int res = 0;
        
        f(i,n)
        {
            if(ms.empty()) break;
            
            auto it = ms.lower_bound(a[i].S);
            
            if(it == ms.end()) continue;
            
            ms.erase(it);
            res += a[i].F;
        }
        
        cout << res << '\n';
    }
    
    
}

signed main()
{
    fast;
    
    int t = 1;
    
//    cin >> t;
    
    while(t--)
        
    solve();
}
