import Control.Arrow
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V 
import qualified Data.Vector.Mutable as VM
import Control.Monad 
import Debug.Trace

main :: IO ()
main = breads >>= main'
    where
        main' [n, m, q] = replicateM m breads >>= calc n >>= main'' q
        main'' q vs = replicateM q breads >>= printRes . solve vs
        printRes = mapM_ print 

type V2 a = V.Vector (V.Vector a)
type MV2 a = VM.IOVector (VM.IOVector a)

calc :: Int -> [[Int]] -> IO (V2 Int)
calc n lrs = initialize >>= fill >>= accumulate >>= finalize
    where
        initialize = VM.replicateM (n + 1) $ VM.replicate (n + 1) 0
        fill vs = vs <$ mapM_ (\[p, q] -> modifyM vs succ (p, q)) lrs
        accumulate vs = vs <$ modify
            where
                modify = mapM_ mf0 [2..n] >> mapM_ mf1 [(x, y) | x <- [2..n], y <- [2..n]]
                mf0 i = do
                    px <- readM vs (i - 1, 1)
                    modifyM vs (+ px) (i, 1)
                    py <- readM vs (1, i - 1)
                    modifyM vs (+ py) (1, i)
                mf1 (i, j) = do
                    x <- readM vs (i - 1, j - 1)
                    y <- readM vs (i - 1, j)
                    z <- readM vs (i, j - 1)
                    modifyM vs (\v -> v + y + z - x) (i, j)
        finalize = V.unsafeFreeze >=> fmap traceShowId . V.mapM V.unsafeFreeze

solve :: V2 Int -> [[Int]] -> [Int]
solve vs = map mf
    where
        mf [p, q] = vs `at` (q, q) + vs `at` (p - 1, p - 1) - vs `at` (p - 1, q - 1) - vs `at` (q - 1, p - 1)

at :: V2 a -> (Int, Int) -> a
at vs (x, y) = vs V.! x V.! y

readM :: MV2 a -> (Int, Int) -> IO a
readM vs (x, y) = VM.unsafeRead vs x >>= flip VM.unsafeRead y

writeM :: MV2 a -> (Int, Int) -> a -> IO ()
writeM vs (x, y) v = VM.unsafeRead vs x >>= (\xs -> VM.unsafeWrite xs y v)

modifyM :: MV2 a -> (a -> a) -> (Int, Int) -> IO ()
modifyM vs f (x, y) = VM.unsafeRead vs x >>= (\xs -> VM.unsafeModify xs f y)

breads :: IO [Int]
breads = unfoldr (\s -> second (maybe B.empty snd . B.uncons) <$> B.readInt s) <$> B.getLine